Aktualizovat „du5/program.c“
This commit is contained in:
parent
d878784ee9
commit
1ff197ade6
@ -38,19 +38,17 @@ int main(){
|
|||||||
int score=0;
|
int score=0;
|
||||||
int c =0;
|
int c =0;
|
||||||
char str[100];
|
char str[100];
|
||||||
char digit[2];
|
|
||||||
while(fgets(str,100,stdin)){
|
while(fgets(str,100,stdin)){
|
||||||
if(str[0]=='\n'){
|
if(str[0]=='\n'){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sscanf(str,"%s %[^\t\n]",&digit,name);
|
sscanf(str,"%d %[^\t\n]",&score,name);
|
||||||
if(isalpha(digit[0])!=0){
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int score = digit[0]-48>=0?((digit[0]-48)*10)+digit[1]-48:0;
|
|
||||||
PersonList[c].score = score;
|
PersonList[c].score = score;
|
||||||
strcpy(PersonList[c].name ,name);
|
strcpy(PersonList[c].name ,name);
|
||||||
c++;
|
c++;
|
||||||
|
Loading…
Reference in New Issue
Block a user