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