// help
cout << "enter numbers of names: " << endl;
cin >> iNumberInputs;
for (int x=0; x<iNumberInput; x++){
cout << "name: " << endl;
gets(name[x]);
}
for(int =0; x<iNumberInputs; x++) {
cout <<"the name you just enter is "<< name[x] << endl;
}
// i need a program that would input numbers of name
// but when i try this, it would just print out:
enter number of names: 3
name: ryu
name: ken
name: knight
the name you just enter is k
the name you just enter is n
the name you just enter is i // <= help!
// how can i program it to out put this
the name you just enter is ryu
the name you just enter is ken
the name you just enter is knight
well i doubt that because I use the same compiler when i do my college exams and my professor uses it too. he has a doctors degree in programming and computer science, he should know which compiler is good or bad :)).. i'm using Mingw compiler..on which compiler\s my code doesn't compile?
my guest is ==> names[number]
this is also my problem
hehehehe
and i cant use vector because im using tc++
and i cant use other compiler because this is the complier that we will use in showing that the program we made will run
when i #include<vector> it gives me an error at school unable to open INCLUDE<VECTOR>
or some thing like that (sorry i forgot the exact sentence because im using another compiler here in my home) i know how to use vector but really it gives me an error in school
is their another way?
ahh tnx weeeeee it works tns bazzy!
where do i use" delet[] names;" in the statements and what its for? ( because it may become handy in future programs)
You can see this tutorial for a long explanation of new and delete: http://www.cplusplus.com/doc/tutorial/dynamic/
A short explanation is: with string*names = new string[number]; you are allocating an array of strings on the heap, delete[] names; is releasing that part of memory. You should call it when you no longer need 'names'