Esc to exit, Any key to start c ++ / c

0

I remember seeing in a random videotutorial that the boy used in his code "Press any key to start the execution, Esc to exit" and I used to think something with a tag called getch or similar, I must implement that in my project and That is one of the parameters, Does anyone know how it is done? I do not pass from the primitive code of:

int main ()
{
printf("Oprima 1 para realizar la ejecucion, De lo contrario pulse cualquier 
tecla");
scanf("%d", &Opcion);

while(Opcion==1)
{ 
// una ejecucion cualquiera
printf("Desea ejecutar nuevamente?");
scanf("%d", &Opcion);
}

}

Thanks in advance

    
asked by Shiro 26.05.2017 в 22:26
source

2 answers

2

printf("Presiona una tecla para continuar"); getch();

I think it could be like this: D

    
answered by 26.05.2017 в 22:48
0

You can use the getch () function

    
answered by 26.05.2017 в 22:41