Aktualizovat „du5/program.c“
This commit is contained in:
parent
b09f1ccbeb
commit
a119f138ab
@ -1,7 +1,7 @@
|
||||
#include<stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include<ctype.h>
|
||||
|
||||
struct person{
|
||||
int score;
|
||||
@ -38,11 +38,16 @@ int main(){
|
||||
int score=0;
|
||||
int c =0;
|
||||
char str[100];
|
||||
char digit[5];
|
||||
while(fgets(str,100,stdin)){
|
||||
if(str[0]=='\n'){
|
||||
break;
|
||||
}
|
||||
sscanf(str,"%d %[^\t\n]",&score,name);
|
||||
sscanf(str,"%s %[^\t\n]",digit,name);
|
||||
if(isalpha(digit[0])!=0){
|
||||
break;
|
||||
}
|
||||
int score = atoi(digit);
|
||||
PersonList[c].score = score;
|
||||
strcpy(PersonList[c].name ,name);
|
||||
c++;
|
||||
|
Loading…
Reference in New Issue
Block a user