I was following this example, but it was done in Windows, so I used <conio.h>
. When I try to run on Linux I get 2 errors: one in *h=int(tempo);
, I do not understand why, and the other in getch
. How can I replace them?
#include <stdio.h>
void horario(float tempo, int *h, int *m)
{
*h=int(tempo);
*m=(tempo-*h)*60;
}
int main ()
{
int hora,minuto;
char resp;
float t;
do
{
printf("Digite o horario na forma centesimal: ");
scanf("%f",&t);
horario(t,&hora,&minuto);
printf("Horario: %02d:02%d\n",hora,minuto);
printf("Quer calcular outro horario? (S/N):");
resp=getch();
} while (resp=='S');
getch();
return 0;
}