-
illegal?
can anyone please look at the code below ( its to enter data in to objects in a class) and explain why the structure is illegal....thanks
its based on OOP principles
Code:
cout << "*******************Person Details*********";
cout << "Please enter person name";
gets(personname);
Names[i].setName(personname); /*sets name in object in class*/
cout << "data entered as follows:";
cout << Names[i].getName();
i++;
-
Code:
cout << "*******************Person Details*********;
You forgot the last "
-
i was told a while back the way the datas entered/objects created is done incorrectly but i cant see how... does anyone know how? thanks:)
-
Use cin.getline( ). Never use gets. Ever. Period.
-
When using istreams and ostreams, use only those. Don't mix C-style input/output with C++ style.