I need interpret in Console screen in C++

Thread Starter

Eng_Bandar

Joined Feb 27, 2010
46
Hi all,

First of all, my problem in Console screen in C++ it is disappear quickly. I use Qt creater 2 to do my code.
Through my search in web I found the solution for it, put the following inside code
Rich (BB code):
#include<cstdio>
getchar();
I trid this code and it is work correctly and I could solve Console screen

Rich (BB code):
#include<iostream>
#include<cstdio>
usingnamespacestd;
intmain(){//prints"m=44andn=77":intm,n;
m=44;//assignsthevalue44tothevariablem
cout<<"m="<<m;n=m+33;
//assignsthevalue77tothevariablencout<<"andn="<<n<<endl;
getchar();
}
But in this code the problem still find
Rich (BB code):
#include<iostream>
#include<cstdio>
usingnamespacestd;
intmain(){inta,b,c;
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
c=a+b;cout<<"a+b="<<c;
getchar();}
Any interpret for this ??!!
 

t06afre

Joined May 11, 2009
5,934
try a this as the last code line
1)cin.get();
2)system ("pause")
You may also execute your program using Start Without Debugging (CTRL+F5). By doing this, you tell Visual Studio that while this is a debuge .exe. You are not using your debugger. Visual Studio will pause at the end of main() with:
Press any key to continue... Therefore, you will never need any special code in your program for testing.
 
Top