Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <time.h>
- #include <cstring>
- #include <stdlib.h>
- #define NUM 7
- long int tempo1, tempo2;
- char words[NUM][12]= {"#include\n", "#define\n", "int main()\n", "return x;\n", "if()\n", "else\n", "while()\n"}, word[12];
- int main(){
- srand(time(NULL));
- tempo1= time(NULL);
- tempo2= tempo1 + 60;
- printf("%ld\n", tempo1);
- int idx, co= 0, er= 0;
- while(tempo1 <= tempo2){
- idx= rand() % NUM;
- printf("%s", words[idx]);
- fgets(word, 12, stdin);
- printf("\n");
- strcmp(words[idx], word) ? er+=1 : co+= 1;
- tempo1= time(NULL);
- }
- printf("Corretas: %d;\nErradas: %d;\nTotal: %d;\n", co, er, co+er);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement