i have write a basic code in c++
#include <iostream>
using namespace std;
void main()
{
cout <<"its my programm";
}
when i compile it cmd line appear for a second and terminated noting was display. its was showing me this output in debug window.
'while.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll'
'while.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll'
'while.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb\msvcp90d.dll'
'while.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb\msvcr90d.dll'
The program '[1480] while.exe: Native' has exited with code 0 (0x0).
help me regarding this .
This should work. The console exits before you can view the program. Using cin.get() will keep the program running until you press enter.
On a related note, your main() function really should be int and not void. I’m pretty sure some compilers do not allow void main().