0

What is the difference between using system("pause") and cin.get(pause)?
Oliver told me never use system("pause").

#include<string>
#include<iostream>

int main(){
 using namespace std;

  string str = "My name is shridhar";
  cout<<"What is your name"<<str;

  char pause = 0;
  cout << "Press enter to continue...";
  cin.get(pause);
}
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by VernonDozier
0

One (system("pause")) involves asking the operating to run a system command and spawn a new process and the other simply waits for input to your program. They are about as different as night and day. As to which to use, cin.get() is usually preferred. If you do a quick Daniweb search on system("pause"), the reasons have been written up pretty well.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.