User forums > Help

Prevent Console Application from closing to fast...

(1/2) > >>

Matthias:
Hi there,

i'm very new to programming in C (new to programming anywhere).
How can i prevent the console from closing very fast after running a programm (for instance when i compile "hello world" and let it run i see the console popping up but it closes so fast i can't recognize anything...)

Thanks for you tipps and advices!

Matthias

P.S.: Sorry for my bad englisch!

aben:
The simple solution is:


--- Code: ---
int main()
{
  std::string str;
  std::cout << "Hello world!" << std::endl;
  std::cin >> str;
  return 0;
}

--- End code ---

squizzz:

--- Code: ---
#include <iostream>

int main()
{
std::cout << "Hello world!" << std::endl;
system("pause");
return 0;
}

--- End code ---


might work fine as well...

rickg22:
wait, didn't the console runner program do that automatically? :?

squizzz:

--- Quote from: rickg22 ---wait, didn't the console runner program do that automatically? :?
--- End quote ---

Hahaha yes it does. (checked)

But then, it doesn't seem to work for Matthias. :?

Navigation

[0] Message Index

[#] Next page

Go to full version