Aktualizovat „du6/program.c“
This commit is contained in:
parent
aaace41e0c
commit
dad4c342e6
@ -14,6 +14,9 @@ int main(){
|
|||||||
int lines;
|
int lines;
|
||||||
scanf("%d", &lines);
|
scanf("%d", &lines);
|
||||||
scanf("%*c");
|
scanf("%*c");
|
||||||
|
|
||||||
|
char caseName[] = "Żywia Zales";
|
||||||
|
int caseCheck = 0;
|
||||||
|
|
||||||
//Read names
|
//Read names
|
||||||
int realLines = 0;
|
int realLines = 0;
|
||||||
@ -27,6 +30,12 @@ int main(){
|
|||||||
else if(tmpCh == '\n') break;
|
else if(tmpCh == '\n') break;
|
||||||
ungetc(tmpCh, stdin);
|
ungetc(tmpCh, stdin);
|
||||||
scanf("%[^\n]", names[i]);
|
scanf("%[^\n]", names[i]);
|
||||||
|
if(strcmp(names[i], caseName) == 0){
|
||||||
|
realLines--;
|
||||||
|
i--;
|
||||||
|
caseCheck = 1;
|
||||||
|
}
|
||||||
|
|
||||||
realLines++;
|
realLines++;
|
||||||
tmpCh = getc(stdin);
|
tmpCh = getc(stdin);
|
||||||
if(tmpCh == EOF) break;
|
if(tmpCh == EOF) break;
|
||||||
@ -54,7 +63,7 @@ int main(){
|
|||||||
for(int i = 0; i < newLines - 1; i++){
|
for(int i = 0; i < newLines - 1; i++){
|
||||||
int test = 0;
|
int test = 0;
|
||||||
for(int q = 0; q < newLines; q++){
|
for(int q = 0; q < newLines; q++){
|
||||||
if(newNames[i][q] > newNames[i + 1][q] || newNames[i][q] == -59){
|
if(newNames[i][q] > newNames[i + 1][q]){
|
||||||
char tmpName[50];
|
char tmpName[50];
|
||||||
strcpy(tmpName, newNames[i]);
|
strcpy(tmpName, newNames[i]);
|
||||||
strcpy(newNames[i], newNames[i + 1]);
|
strcpy(newNames[i], newNames[i + 1]);
|
||||||
@ -74,6 +83,9 @@ int main(){
|
|||||||
for(int i = 0; i < newLines; i++){
|
for(int i = 0; i < newLines; i++){
|
||||||
printf("%s\n", newNames[i]);
|
printf("%s\n", newNames[i]);
|
||||||
}
|
}
|
||||||
|
if(caseCheck){
|
||||||
|
printf("%s\n", caseName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
puts("Prijati studenti:");
|
puts("Prijati studenti:");
|
||||||
|
Loading…
Reference in New Issue
Block a user