Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with this program. I need it in C language. I also have the shuffle

ID: 3908654 • Letter: I

Question

I need help with this program. I need it in C language. I also have the shuffle code. I will provide it. Thank you

#include <stdio.h>

int main() {
   srand(time(NULL));
   unsigned char data2[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
   int i, temp, ind;
   for(i = 0; i < sizeof(data2); ++i) {
      ind = rand() % sizeof(data2);
      temp = data2[ind];
      data2[ind] = data2[i];
      data2[i] = temp;
   }
   for(i = 0; i < sizeof(data2); ++i) {
      printf("%d ", data2[i]);
   }
   printf(" ");
   return 0;
}

| National Geographic Be x | e Chegg Study | Guided Solut | + ? ????https://csus.instructure.com/courses/35025/assignments/279465 Summer 2018 National Geographic Bee Submit Assignment Home Announcements Assignments Discussions Grades People Pages Files Syllabus Quizzes Modules Collaborations Blackboard Col Account Due Sunday by 11:59pm Points 70 Submitting a file upload This was discussed in the class on June 18th. Courses The file to read questionbank.txt has 50 questions. Calendar nt score 0 Inbox You will store the questions in array of structures. The array size is 50 cells, each cell is a structure whose fields are given below Help From the array of 50 questions, Your program will use only random 10 questions [30 points] laborate Your program will prompt each of the 10 questions and choices to the user. [20 points] Type here to search 37 6/24/2018 20

Explanation / Answer

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct _question {
    char question[100];
    char choice1[100];
    char choice2[100];
    char choice3[100];
    char choice4[100];
    char correctAnswer[4];
};

int main(){

   int i;
   struct _question data[50];

   srand(time(NULL));
   FILE *fp = fopen("questionbank.txt", "r");
   if (fp == NULL){
       printf("Error in opening file ");
       return;
   }
   int score = 0;
   for (i = 0; i<50; i++){
       fgets(data[i].question,100, fp);
       fgets(data[i].choice1,100, fp);
       fgets(data[i].choice2,100, fp);
       fgets(data[i].choice3,100, fp);
       fgets(data[i].choice4,100, fp);
       fgets(data[i].correctAnswer,100, fp);

   }
   for (i = 0; i<10; i++){
       int n = rand() % 50;
       printf("%s ",data[n].question);
       printf("%s ",data[n].choice1);
       printf("%s ",data[n].choice2);
       printf("%s ",data[n].choice3);
       printf("%s ",data[n].choice4);
     
       printf("Enter your answer:");
       char ans[4];
       scanf("%s",ans);
       if (strcmp(ans,data[i].correctAnswer)== 0){
          score++;
          printf("%s ","Good Job!");
       }
       else {
          printf("Sorry ");
       }

   }
   return 0;
}