i m having so many problems,i m trying to make an hotel database management program in win32 console and i m not allowed to use structures,only variables or pointer or Dynmaic arryas.
i m using 2d dynamic array,i have to pass it to a function to store values in it,i cant get input,
i have a main menu,and the input must be inside another function.please help!
here is my code:
#include "stdafx.h"
#include "iostream"
#include "windows.h"
#using <mscorlib.dll>
using namespace System;
using namespace std;
void record();
void trans();
void addcustomer(char *c,int n);
void addhotel();
void queries();
void sort();
void search();
void showittome();
void trans()
{
int t;
cout << "--------Transactions Menu------------" << endl << endl;
cout << "To Add A Record,Press 1 " << endl;
cout << "To Delete A Record,Press 2 " << endl;
cout << "To Update A Record,Press 3 " << endl;
cin >> t;
switch(t)
{
case 1:
{
system("cls");
record();
break;
}
case 2:
{
system("cls");
break;
}
case 3:
{
system("cls");
break;
}
}
}
void record()
{
int r;
cout << "-----------Record Menu------------" << endl << endl;
cout << "To Add A Customer Record,Press 1 " << endl;
cout << "To Delete A Hotel Record,Press 2 " << endl;
cin>> r;
switch(r)
{
case 1:
{
system("cls");
addcustomer("arshad",1);
break;
}
case 2:
{
system("cls");
addhotel();
break;
}
}
}
void addcustomer(char *c,int n=0)
{
cout << " ------- Add Customer Record --------" << endl << endl;
for(int i=0;i<n;i++)
{
cout << "Please Enter Customer Name: " << endl;
//cin.getline(c[i]=new char[20],20);
cin.ignore();
cout << c[i]<< endl;
cout << "Please Enter Customer NIC Number: " << endl;
//cin.getline(c[i+1]= new char[20],20);
cin.ignore();
cout << c[i+1]<< endl;
cout << "Please Enter Customer Telephone: Number " << endl;
cout << "Please Enter Customer Room Number: " << endl;
cout << "Please Enter Customer Entry Date and Time: " << endl;
cout << "Please Enter Customer Exit Date and Time: " << endl;
cout << "Please Enter Customer Payments: " << endl;
cout << "Please Enter Customer Status: " << endl;
}
}
void addhotel()
{
cout << " ------- Add Hotel Record --------" << endl << endl;
cout << "Please Enter Number Of Rooms Available: " << endl;
cout << "Please Enter Room Number: " << endl;
cout << "Please Enter Room Type: " << endl;
cout << "Please Enter Room Charges: " << endl;
cout << "Please Enter Number Of Present Rooms: " << endl;
}
void queries()
{
int q;
cout << " ---------- Queries Menu --------" << endl << endl;
cout << "To Check Availability Of a Given Room,Press 1 " << endl;
cout << "To Check The Status of Customer by His Name or NIC,Press 2 " << endl;
cout << "To Calculate Bill of a Customer Based On the Number of Days Stayed,Press 3 " << endl;
cin >> q;
switch(q)
{
case 1:
{
system("cls");
break;
}
case 2:
{
system("cls");
break;
}
case 3:
{
system("cls");
break;
}
}
}
void sort()
{
cout << " ---------- Sorting Menu --------" << endl << endl;
}
void search()
{
cout << " ---------- Searching Menu --------" << endl << endl;
}
void showittome()
{
cout << " ---------- Print All Data Menu --------" << endl << endl;
}
int _tmain()
{
int choice,n;
cout << "Please Enter the number of records you want to Enter: " << endl;
cin>>n;
char **c=new char*[n];
cin.ignore();
cout << "Database Hotel Management System ...." << endl << endl;
cout << "To Go to Transactions Menu,Press 1 " << endl;
cout << "To Go to Queries Menu,Press 2 " << endl;
cout << "To Go to Sorting Menu,Press 3 " << endl;
cout << "To Search The Existing Record,Press 4 " << endl;
cout << "To Show All Database Information,Press 5 " << endl;
cin >> choice;
switch(choice)
{
case 1:
{
system("cls");
trans();
break;
}
case 2:
{
system("cls");
queries();
break;
}
case 3:
{
system("cls");
sort();
break;
}
case 4:
{
system("cls");
search();
break;
}
case 5:
{
system("cls");
showittome();
break;
}
}
return 0;
}