I wanted my program to pause the screen. I need it to work in linux and windows. I wished to use the system("xxx") command but dont know what system command is to be used in linux.
I just learned from the other post that system("cls") is for windows while system("clear") is for linux. So if system("pause") is for windows, what is for linux?
I know that cin.get works but I wished to use the system command if there is one.
You can't claim that it doesn't work by mis-using it. Consider the following:
1 2 3 4 5 6 7 8
int age;
string name;
cout << "Enter your age:";
cin >> age;
cout << "Enter your name: ";
getline( cin, name );
Can I claim that getline() doesn't work?
Also consider, your code is broken if the person tries to enter their name as "John Jacob Jingleheimer Schmidt".
Once the user corrupts the input stream it is the programmer's prerogative to fix it, _not_ various library functions. That is, library functions should not play with the state or contents of a stream unless they are explicitly listed to do it.