我有这个代码,我想知道为什么我的代码跳过scanf ...
#include <stdio.h>
char nombre[20];
int tipo;
int edad;
int dias;
int repetir=0;
int main()
{
while (repetir==0){
int error=0;
do{
printf("Diga su Nombre: ");
scanf("%19[^\n]", nombre);
printf("Diga el tipo de Sala: ");
scanf("%d", & tipo);
printf("Diga la edad del Paciente: ");
scanf("%d", & edad);
printf("Dias de Hospitalizacion: ");
scanf("%d", & dias);
if ((tipo>4) || (tipo<0) || (edad<0) || (dias <0) ){
printf("Eror al ingresar los datos");
} else {
error = 1;
}
}
while(error==0);
printf("¿Algun otro paciente? …Run Code Online (Sandbox Code Playgroud)