Aktualizovat „du5/program.c“

This commit is contained in:
Bohdan Yanchyk 2020-04-09 23:59:27 +00:00
parent b2d5ae345f
commit ce83440de1

View File

@ -39,17 +39,14 @@ int main(){
int c =0; int c =0;
char str[100]; char str[100];
while(fgets(str,100,stdin)){ while(fgets(str,100,stdin)){
if(str[0]=='\n'){ if(isalpha(str[0])!=0||str[0]=='\n'){
break;
}
sscanf(str,"%d %[^\t\n]",&score,name);
if(isalpha(str[0])!=0){
if(c==0){ if(c==0){
printf("Nepodarilo nacitat nic\n"); printf("Nepodarilo nacitat nic\n");
return 0; return 0;
} }
break; break;
} }
sscanf(str,"%d %[^\t\n]",&score,name);
PersonList[c].score = score; PersonList[c].score = score;
strcpy(PersonList[c].name ,name); strcpy(PersonList[c].name ,name);
c++; c++;