cv5
This commit is contained in:
parent
ae383fb1d4
commit
c28dff4800
@ -17,7 +17,7 @@ int find_student(struct student* students,int size, const char* name){
|
||||
return i; //ak najde studenta
|
||||
}
|
||||
}
|
||||
printf("nenaslo studenta\n"); // ak nenajde studenta
|
||||
//printf("nenaslo studenta\n"); // ak nenajde studenta
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -41,12 +41,14 @@ int main(){
|
||||
memset(line,0,SIZE);
|
||||
char* r = fgets(line,SIZE,stdin);
|
||||
if (r == NULL){
|
||||
return -1;
|
||||
}
|
||||
|
||||
//nacitanie celeho cisla, premiena kym nepride na znak ktory nieje cislo
|
||||
char* end = NULL;
|
||||
int value = strtol(line,&end,10);
|
||||
if (value == 0){
|
||||
return 1;
|
||||
}
|
||||
// pomocné pole
|
||||
char name[SIZE];
|
||||
@ -66,6 +68,7 @@ int main(){
|
||||
}
|
||||
else {
|
||||
printf( "nepodarilo sa nacitat meno \n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
//prejde vsetky polozky v databaze
|
||||
@ -79,11 +82,16 @@ if (id< 0){
|
||||
}
|
||||
else{
|
||||
printf("databaza je plna\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
databaza[id].votes = value;
|
||||
}
|
||||
|
||||
printf("Vysledky:\n");
|
||||
for (int i = 0; i < size; i++){
|
||||
printf ("%d %s\n", databaza[i].votes, databaza[i].name);
|
||||
}
|
||||
return 0;
|
||||
}
|
BIN
cv5/program.exe
BIN
cv5/program.exe
Binary file not shown.
Loading…
Reference in New Issue
Block a user