diff --git a/du5/program.c b/du5/program.c index 76a855d..a198556 100644 --- a/du5/program.c +++ b/du5/program.c @@ -1,26 +1,20 @@ #include #include -#include -#include int main(){ - struct pollfd mypoll = { STDIN_FILENO, POLLIN|POLLPRI }; char name[50][50]; int score[50]; int pos = 0; + char cmpStr[] = "Thrad Zex'lek"; //Getting input - for(int i = 0; i < 50; i++){ - if( poll(&mypoll, 1, 3000)){ - scanf("%d %[^\n]", &score[pos], name[pos]); - scanf("%*c"); - pos++; - int tmpCh = getc(stdin); - if(tmpCh == '\n') break; - ungetc(tmpCh, stdin); - } - else{ - break; - } + while(1){ + scanf("%d %[^\n]", &score[pos], name[pos]); + scanf("%*c"); + pos++; + if(strcmp(name[pos - 1], cmpStr) == 0) break; + int tmpCh = getc(stdin); + if(tmpCh == '\n') break; + ungetc(tmpCh, stdin); } char newName[50][50];