Browse Source

random question in r5 to make it more difficult.

main
parent
commit
af792bc242
  1. 30
      src/main/quizproject.c
  2. 2
      src/main/quizproject.h

30
src/main/quizproject.c

@ -308,7 +308,7 @@ void print_guess_word_question (char guessWord[][100], char guessSolution[][100]
} }
void e_printout(char print_out_questn[][100], char questions[][100]) {
void e_printout(char print_out_questn[][100], char questions[][100],int randArr[]) {
printf("\t\t---------------------------Round5-----------------------------\n\n"); printf("\t\t---------------------------Round5-----------------------------\n\n");
@ -318,22 +318,24 @@ void e_printout(char print_out_questn[][100], char questions[][100]) {
char usr_ans[100]; char usr_ans[100];
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
printf("[%d] Guess is the correct word for this anagram: %s\n", i+1, print_out_questn[i]);
int rNum = randArr[i];
printf("[%d] Guess is the correct word for this anagram: %s\n", i+1, print_out_questn[rNum]);
printf("Answer: "); printf("Answer: ");
scanf(" %s", usr_ans);
scanf("%s", usr_ans);
int k = 0; int k = 0;
for (int j = 0; j < strlen(print_out_questn[i]); j ++){
if(usr_ans[j] == questions[i][j]) {
for (int j = 0; j < strlen(print_out_questn[rNum]); j ++){
if(usr_ans[j] == questions[rNum][j]) {
k++; k++;
} }
} }
if (k == strlen(print_out_questn[i]) && strlen(usr_ans) == strlen(print_out_questn[i])) {
printf("Correct!\n");
if (k == strlen(print_out_questn[rNum]) && strlen(usr_ans) == strlen(print_out_questn[rNum])) {
score++;
printf("Correct!\nYou have %d points\n", score);
} else { } else {
printf("Wrong!\n"); printf("Wrong!\n");
printf("The word is: %s\n", questions[rNum]);
} }
} }
@ -377,9 +379,17 @@ void e_anagram_questions() {
} }
} }
//random geneator for questionmix
int charArr2[6];
int p1 = 0;
for(int l = 0; l < 100; l++) {
if (charNum[l] < 6) {
charArr2[p1] = charNum[l];
p1++;
}
}
e_printout(print_questions,questions);
e_printout(print_questions,questions, charArr2);
} }

2
src/main/quizproject.h

@ -47,7 +47,7 @@ void e_printout_r3 (char [][100], char [][100]);
int track_r2_score = 0; int track_r2_score = 0;
void guess_word_questions(void); void guess_word_questions(void);
void print_guess_word_question (char [][100], char [][100],char [][100], int []); void print_guess_word_question (char [][100], char [][100],char [][100], int []);
void e_printout(char [][100], char [][100]);
void e_printout(char [][100], char [][100], int []);
void e_anagram_questions(void); void e_anagram_questions(void);
//----smart_brain_header_end------- //----smart_brain_header_end-------

Loading…
Cancel
Save