Изменить 'du6/program.c'

^^
This commit is contained in:
Oleksandr Hryshchenko 2021-04-15 18:36:09 +00:00
parent 0bfa0b68c9
commit 892284a6db

View File

@ -11,14 +11,14 @@ int main(){
int count = 0;
char temp[50];
for(int i =0; fgets(inputs[i], 50, stdin) != NULL;; i++){
for(int i =0; fgets(inputs[i], 50, stdin) != NULL; i++){
if(i == 0){
freePlaces = strtol(inputs[0], &ptr, 10);
if(freePlaces < 0 || !sdigit(freePlaces)){
if(freePlaces < 0 || !isdigit(freePlaces)){
printf("Nespravny vstup\n");
}
}
else if(i == 1 && !salpha(inputs[i][0])){
else if(i == 1 && !isalpha(inputs[i][0])){
printf("Ziadne prihlasky\n");
return 0;
}
@ -54,12 +54,12 @@ int main(){
puts("Prijati studenti:\n");
for(int i = 0; i < finalPosition; i++) {
puts ("%s\n", inputs[i]);
printf ("%s\n", inputs[i]);
if(i == 4) break;
}
puts("Neprijati studenti:\n");
for(int i = 5; i < finalPosition; i++){
puts("%s\n", inputs[i]);
printf("%s\n", inputs[i]);
}
free(ptr);