Изменить 'du5/program.c'
^^
This commit is contained in:
parent
9bd06aa07c
commit
68c8725ddb
@ -1,5 +1,40 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
struct entry{
|
||||||
|
char* name;
|
||||||
|
int votes;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct entry* createEntry(char* name, int votes){
|
||||||
|
struct entry* newEntry = (struct entry*) calloc(1, sizeof(struct entry));
|
||||||
|
strcpy(newEntry->name, name);
|
||||||
|
newEntry->votes = votes;
|
||||||
|
return newEntry;
|
||||||
|
}
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
|
struct entry myEntries[100];
|
||||||
|
char inputs[100][50];
|
||||||
|
int counter = 0;
|
||||||
|
char symbol;
|
||||||
|
char* number1 = (char*) calloc (25, sizeof(char));
|
||||||
|
|
||||||
|
for(int i = 0; fgets(inputs[1], 50, stdin) != NULL; i++){
|
||||||
|
counter = 0;
|
||||||
|
symbol = inputs[i][counter++];
|
||||||
|
while(symbol != '\0' && symbol != '\n'){
|
||||||
|
while(isspace(symbol))
|
||||||
|
symbol = inputs[i][counter++];
|
||||||
|
|
||||||
|
if(isdigit(symbol))
|
||||||
|
number1 += symbol;
|
||||||
|
else if(isalpha)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user