# C/C++ stop command



## ted-m

ok so I'm trying to learn C and C++ and the example programs go by so fast I can't read them, I think there was a pause command that made the program freeze untill you pressed enter, but I don't know what it is, so far I remember it was getch (); but I don't know where to put the command, this is the code :

#include <stdio.h>

int main()
{
printf("This is a line of text to output.\n");
printf("And this is another ");
printf("line of text.\n\n");
printf("This is a third line.\n");

return 0;
}


Please repost that exact code with the command you recommend placed where it is supposed to be, muchos gracias


----------



## zyntrax

There are two diffirent solution i can come up with.

Number 1 <--

#include <stdio.h>
#include <conio.h> //<--

int main()
{
printf("This is a line of text to output.\n");
printf("And this is another ");
printf("line of text.\n\n");
printf("This is a third line.\n");

_getch(); //<--
return 0;
}

Number 2 <--

#include <stdio.h>

int main()
{
printf("This is a line of text to output.\n");
printf("And this is another ");
printf("line of text.\n\n");
printf("This is a third line.\n");

system("pause"); //<--
return 0;
}

I recommend number 1 because it doesnt show the ugly text Press enter or whatever


----------

