How to get Input in 2D dynamic array??

i m making a hotel database management system and i have to add records, update and delete them.i m having problem in getting the input,how will i use double pointers?? and i have to get a certain number of records from the user.

here is my code:

void addcustomer()
{
int n;

cout << " ------- Add Customer Record --------" << endl << endl;

cout << "Please Enter the number of records you want to Enter: " << endl;

cin>>n;

char ** c=new char*[n];

cout << "Please Enter Customer Name: " << endl;

// dont know how to get input!

cout << "Please Enter Customer NIC Number: " << 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;








}


how would i get input in the 2d array?

and one more thing,if i get input in one function,would i be able to use the same record in another function?
Last edited on
Take a look at this:
http://cplusplus.com/forum/articles/6046/

In general you should just start reading articles on this website that answer most of your questions. Your questions are too many and the code that you have written is too incomplete. I wouldn't even know where to begin and I don't think it would help you much to even try.
http://cplusplus.com/forum/articles/

I will give you a couple of hints. You need to research the while loop and do..while loops. You need to research iostreams. You'll probably need to gather input from the user in numeric formats and sometimes strings. You'll need some kind of class or data structure to hold all of the elements of a record. In order to make the data entered in your function available to others, you'll need to return the records from the function or insert them into some kind of database that is accessible to other functions. You could research the singleton pattern. Just read some of the links I gave and take it one small step at a time.
You can try

 
cin.getline(array_name, length_of_your_array);
Topic archived. No new replies allowed.