So, my problem is that I would love to use cin.get(); instead of system("pause"); but it's not just working on application I just made. For previous it worked great.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
int main()
{
usingnamespace std;
int cipars;
cout << "How many do you want?";
cout << endl;
cin >> cipars;
cout << "You want: ";
cout << cipars;
cout << endl;
cin.get();
return 0;
}
You'll still need the cin.get() (or cin.ignore()). cin.sync() clears the buffer, cin.get()/ignore() tries to get something from the buffer, but because it's empty it will pause the console and prompt the user to fill it up.
For professional programming (at least), the system() function can't always be trusted. For simply testing a program, maybe, but I personally still wouldn't use it.
I would also prefer a std::pause() function, but seeing as there isn't one we'll make do with what we have.