Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main(int argc, char **argv)
- {
- double answer;
- printf("|*************************** Welcome to the exercise_4 ! ***************************|\n");
- printf("| |\n");
- printf("| |\n");
- printf("|In this program we will be able to evaluate all the students we want ! |\n");
- printf("| |\n");
- printf("| |\n");
- printf("|Would you like to enter in the program ? Press [1/0] ( 1 -> Enter || 0 -> Quit) |\n");
- printf("| |\n");
- printf("| |\n");
- printf("|***********************************************************************************|\n");
- printf("\n\nChoice : ");
- scanf("%lf", &answer);
- system("cls");
- while((int)answer<0 || (int)answer>1){
- printf("Error, please enter a correct value : ");
- scanf("%lf",&answer);
- system("cls");
- }
- while(answer==1){
- double menuloop = 1;
- int *answerArray=NULL;
- int *studentArray=NULL;
- int *statsArray=NULL;
- int rangeStats;
- int dataRange;
- int initStats = 0;
- int mark;
- int maxIndex;
- int max = 0;
- int min = 0;
- int maxStudent= 0;
- int minStudent= 0;
- int class;
- double average = 0;
- double nbAnswer;
- int init = 0;
- int initAnswer = 0;
- double valueAnswer;
- double nbStudent;
- int valueStudent;
- double studentTag;
- double studentAnswer;
- double underMenu2;
- double underMenu3;
- double answerUnderMenu2;
- double questionChange;
- double answerChange;
- double modifySelect;
- double changeValue;
- double modifyService;
- double underMenu4;
- int existStudent = 0;
- int verifStudent = 0;
- int studentNumber;
- srand(time(NULL));
- while(menuloop==1){
- double menuanswer;
- int i;
- int j=0;
- int a = 1;
- printf("\n\n|**************************************** Menu ****************************************|\n");
- printf("| |\n");
- printf("| |\n");
- printf("|Select the option you want : |\n");
- printf("| |\n");
- printf("|1 Select the correction of the questions, and display it |\n");
- printf("|2 Enter the number of students you want, their answers and their service number |\n");
- printf("|3 Modify the array |\n");
- printf("|4 Display result of a student |\n");
- printf("|5 Display statistics |\n");
- printf("|6 Menu of the array generation |\n");
- printf("|7 Reset the array |\n");
- printf("|8 Exit the menu |\n");
- printf("| |\n");
- printf("|**************************************************************************************|\n");
- printf("\n\nChoice :");
- scanf("%lf",&menuanswer);
- system("cls");
- while((int)menuanswer<=0 ||(int)menuanswer>8){
- printf("Error, please enter a correct value : ");
- scanf("%lf",&menuanswer);
- system("cls");
- }
- switch((int)menuanswer){
- case 1:{
- double underMenuAnswer;
- double menuloop2=1;
- while(menuloop2 == 1){
- printf("\n\nWhat do you want to do ?\n");
- printf("1\\Enter the correction\n\n");
- printf("2\\Display the correction\n\n");
- printf("3\\Exit\n\n");
- printf("\n\nChoice :");
- scanf("%lf",&underMenuAnswer);
- system("cls");
- while((int)underMenuAnswer<=0 ||(int)underMenuAnswer>3){
- printf("Error, please enter a correct value : ");
- scanf("%lf",&underMenuAnswer);
- system("cls");
- }
- switch((int)underMenuAnswer){
- case 1:{ // CORRECTION MENU
- if(initAnswer == 1){
- printf("\n\nPlease, reset or modify the array before trying to select an other correction ! ");
- break;
- }
- printf("\n\nHow many questions are there ? (Select a value between 10 and 100)\n");
- printf("Choice : ");
- scanf("%lf",&nbAnswer);
- system("cls");
- while((int)nbAnswer<10 || (int)nbAnswer>100){
- printf("\n\nThere is no interest in doing an evaluation of 0 or more than 100 questions. Please enter a value between 10 and 100\n");
- printf("Value : ");
- scanf("%lf",&nbAnswer);
- system("cls");
- }
- answerArray=malloc(sizeof(int)*nbAnswer);
- for(i=0;i<(int)nbAnswer;i++){ // ENTRY OF THE CORRECTION
- printf("Question number %d : ",i+1);
- scanf("%lf",&valueAnswer);
- system("cls");
- while((int)valueAnswer<=0 ||(int)valueAnswer>5){
- printf("\n\nYou can not enter a negative number, a 0 or a higher number than 5 as a correction. An answer is between 1 and 5 !");
- printf("Value : ");
- scanf("%lf",&valueAnswer);
- system("cls");
- }
- answerArray[i]=(int)valueAnswer;
- }
- initAnswer = 1;
- break;
- }
- case 2:{
- if(initAnswer == 0){
- printf("Enter a correction before trying to display it !");
- break;
- }
- printf("The good answers are : \n");
- for(i=0;i<(int)nbAnswer;i++){
- printf("Question %d : %d | ",i+1,answerArray[i]);
- if(i%6==5){
- printf("\n");
- }
- }
- }
- case 3:{
- menuloop2=0;
- break;
- }
- }
- }
- break;
- }
- case 2:{ // MANANGING STUDENT
- if(initAnswer == 0){
- printf("Error, please enter a correction before trying to manage the students results");
- break;
- }
- printf("\n\nEnter the number of students you want : ");
- scanf("%lf",&nbStudent);
- system("cls");
- while((int)nbStudent<0 || (int)nbStudent == 0 ){
- printf("\n\nYou can not enter a 0 or a negative number as a number of student. Please enter a correct value : ");
- scanf("%lf",&nbStudent);
- system("cls");
- }
- valueStudent = ((int)nbAnswer+1)*(int)nbStudent;
- studentArray = malloc(sizeof(int)*valueStudent);
- for(i=0;i<valueStudent;i++){ // ENTRY OF A STUDENT
- if(i%((int)nbAnswer+1) == 0){
- j++;
- printf("Please, enter the service number of the student %d : ",j);
- scanf("%lf",&studentTag);
- system("cls");
- while(studentTag/10000 < 1 || studentTag/100000 >=1 || (int)studentTag<=0){
- printf("Error, the service number of a student has to be entered with 5 numbers ! ");
- printf("Student number : ");
- scanf("%lf",&studentTag);
- system("cls");
- }
- studentArray[i] = (int)studentTag;
- }
- if(i%((int)nbAnswer+1) != 0){
- printf("Response %d of the student number %g : ",a,studentTag);
- scanf("%lf",&studentAnswer);
- system("cls");
- while((int)studentAnswer<1 || (int)studentAnswer>5){
- printf("Error, please enter a correct value. Answer needs to be between 1 and 5 : ");
- scanf("%lf",&studentAnswer);
- system("cls");
- }
- studentArray[i] = (int)studentAnswer;
- a++;
- if(a%((int)nbAnswer+1) == 0){
- a=1;
- }
- }
- }
- init = 1;
- break;
- }
- case 3:{
- if(initAnswer == 0){
- printf("Before trying to modify the array, please enter the correction in the array !");
- break;
- }
- if (init == 0){
- printf("Before trying to modify the array, please enter the students in the array !");
- break;
- }
- int menuloop3 = 1;
- while(menuloop3 == 1){ // MODIFY ARRAY
- printf("|********************MENU**********************|\n");
- printf("|What do you want to modify in the array ? |\n");
- printf("| |\n");
- printf("|1 Modify the correction |\n");
- printf("|2 Modify the service number of a student |\n");
- printf("|3 Modify the answers of a student |\n");
- printf("|4 Exit |\n");
- printf("| |\n");
- printf("|----------------------------------------------|\n");
- scanf("%lf",&underMenu2);
- system("cls");
- while((int)underMenu2<=0 || (int)underMenu2>4){
- printf("Error, please enter a correct value : ");
- scanf("%lf",&underMenu2);
- system("cls");
- }
- switch((int)underMenu2){
- case 1:{ // MODIFY SELECTION OF THE CORRECTION
- printf("\n\nWould you like to modify a specific question or all ? (0 -> specific question /\\ 1 -> All the questions )\n");
- printf("Choice : ");
- scanf("%lf",&answerUnderMenu2);
- system("cls");
- while((int)answerUnderMenu2<0 ||(int)answerUnderMenu2>1){
- printf("Error, enter a correct value : ");
- scanf("%lf",&answerUnderMenu2);
- system("cls");
- }
- if(answerUnderMenu2 == 1){ // ANSWER SELECTED FOR CORRECTION
- for(i=0;i<(int)nbAnswer;i++){
- printf("Question number %d : ",i+1);
- scanf("%lf",&valueAnswer);
- system("cls");
- while((int)valueAnswer<=0 ||(int)valueAnswer>5){
- printf("\n\nYou can not enter a negative number, a 0 or a higher number than 5 as a correction. An answer is between 1 and 5 !");
- printf("Value : ");
- scanf("%lf",&valueAnswer);
- system("cls");
- }
- answerArray[i]=(int)valueAnswer;
- }
- }else{
- printf("The good answers are : \n"); // DISPLAY THEM
- for(i=0;i<(int)nbAnswer;i++){
- printf("Question %d : %d | ",i+1,answerArray[i]);
- if(i%6==5){
- printf("\n");
- }
- }
- printf("\n\nWhich question would you like to change ?");
- scanf("%lf",&questionChange);
- while((int)questionChange<=0 ||(int)questionChange>(int)nbAnswer){
- printf("\n\nThis question does not exist ! The questions are from 1 to %g ! Please enter a correct value : ",nbAnswer);
- scanf("%lf",&questionChange);
- system("cls");
- }
- printf("\n\nThe response of the question number %g is : %d ",questionChange,answerArray[(int)questionChange-1]);
- printf("\n\nEnter the new value : ");
- scanf("%lf",&answerChange);
- system("cls");
- while((int)answerChange<=0 ||(int)answerChange>5){
- printf("\n\nError, enter a correct value, between 1 and 5 : ");
- scanf("%lf",&answerChange);
- system("cls");
- }
- answerArray[(int)questionChange-1]=(int)answerChange;
- }
- break;
- }
- case 2:{ // SELECTION OF THE STUDENT YOU WANT
- verifStudent=0;
- printf("\n\nList of students : \n");
- for(i=0;i<valueStudent;i++){
- if(i%((int)nbAnswer+1)== 0){
- printf(" Student %d ||",studentArray[i]);
- }
- }
- printf("Enter the student you want to modify : ");
- scanf("%lf",&modifySelect);
- while(modifySelect/10000 < 1 || modifySelect/100000 >=1 || (int)modifySelect<=0){
- printf("Error, the service number of a student has to be entered with 5 numbers ! ");
- printf("Student number : ");
- scanf("%lf",&modifySelect);
- system("cls");
- }
- while(verifStudent == 0){
- for(i=0;i<valueStudent;i++){
- if(studentArray[i] == (int)modifySelect){
- verifStudent=1;
- }
- }
- if(verifStudent==0){
- printf("Error, this student does not exist. Please enter a correct number : ");
- scanf("%lf",&modifySelect);
- system("cls");
- }
- }
- printf("\n\nNow modify his service number : "); // MODIFY A STUDENT
- scanf("%lf",&modifyService);
- while(modifyService/10000 < 1 || modifyService/100000 >=1 || (int)modifyService<=0){
- printf("Error, the service number of a student has to be entered with 5 numbers ! ");
- printf("Student number : ");
- scanf("%lf",&modifyService);
- system("cls");
- }
- while(existStudent == 0){
- for(i=0;i<valueStudent;i++){
- if(studentArray[i] == (int)modifyService){
- existStudent++;
- }
- }
- if(existStudent==0){
- break;
- }
- if(existStudent>0){
- printf("Error, this student already exists. Please enter a unique number : ");
- scanf("%lf",&modifyService);
- system("cls");
- existStudent=0;
- }
- }
- printf("His service number is now : %g ",modifyService);
- break;
- }
- case 3:{ // DISPLAY AND MODIFY ANSWERS OF A STUDENT
- verifStudent=0;
- printf("\n\nList of students : \n");
- for(i=0;i<valueStudent;i++){
- if(i%((int)nbAnswer+1)== 0){
- printf(" Student %d ||",studentArray[i]);
- }
- }
- printf("Enter the student you want to modify : ");
- scanf("%lf",&modifySelect);
- while(modifySelect/10000 < 1 || modifySelect/100000 >=1 || (int)modifySelect<=0){
- printf("Error, the service number of a student has to be entered with 5 numbers ! ");
- printf("Student number : ");
- scanf("%lf",&modifySelect);
- system("cls");
- }
- while(verifStudent == 0){
- for(i=0;i<valueStudent;i++){
- if(studentArray[i] == (int)modifySelect){
- verifStudent=1;
- }
- }
- if(verifStudent==0){
- printf("Error, this student does not exist. Please enter a correct number : ");
- scanf("%lf",&modifySelect);
- system("cls");
- }
- }
- printf("Here is the answers of the student :");
- for(i=0;i<valueStudent;i++){
- if(studentArray[i] == (int)modifySelect){
- for(j=0;j<nbAnswer;j++){
- printf(" Question %d : %d ||",j+1,studentArray[i+j+1]);
- }
- }
- }
- printf("Modify his answers : ");
- for(i=0;i<valueStudent;i++){
- if(studentArray[i] == (int)modifySelect){
- for(j=0;j<nbAnswer;j++){
- printf(" Question %d : \n",j+1);
- scanf("%lf",&changeValue);
- system("cls");
- while((int)changeValue<1 || (int)changeValue>5){
- printf("Error, answer needs to be between 1 and 5. Correct value : ");
- scanf("%lf",&changeValue);
- system("cls");
- }
- studentArray[i+j+1]=(int)changeValue;
- }
- }
- }
- }
- case 4:{
- menuloop3 = 0;
- break;
- }
- }
- }
- break;
- }
- case 4:{ // SELECTION OF THE STUDENTS AND GET HIS ANSWERS
- if(initAnswer == 0){
- printf("Before trying to display a student, please enter the correction in the array !");
- break;
- }
- if (init == 0){
- printf("Before trying to display a student, please enter the students in the array !");
- break;
- }
- verifStudent=0;
- printf("\n\nList of students : \n");
- for(i=0;i<valueStudent;i++){
- if(i%((int)nbAnswer+1)== 0){
- printf(" Student %d ||",studentArray[i]);
- }
- }
- printf("Enter the student you want to modify : ");
- scanf("%lf",&modifySelect);
- while(modifySelect/10000 < 1 || modifySelect/100000 >=1 || (int)modifySelect<=0){
- printf("Error, the service number of a student has to be entered with 5 numbers ! ");
- printf("Student number : ");
- scanf("%lf",&modifySelect);
- system("cls");
- }
- while(verifStudent == 0){
- for(i=0;i<valueStudent;i++){
- if(studentArray[i] == (int)modifySelect){
- verifStudent=1;
- }
- }
- if(verifStudent==0){
- printf("Error, this student does not exist. Please enter a correct number : ");
- scanf("%lf",&modifySelect);
- system("cls");
- }
- }
- printf("Here is the answers of the student :");
- for(i=0;i<valueStudent;i++){
- if(studentArray[i] == (int)modifySelect){
- for(j=0;j<nbAnswer;j++){
- printf(" Question %d : %d ||",j+1,studentArray[i+j+1]);
- }
- }
- }
- break;
- }
- case 5:{ // MENU STATS
- if(initAnswer == 0){
- printf("Before trying to display statistics, please enter the correction in the array !");
- break;
- }
- if (init == 0){
- printf("Before trying to display statistics, please enter the students in the array !");
- break;
- }
- int menuloop4 = 1;
- rangeStats=1+(int)nbAnswer+((int)nbStudent*2);
- statsArray = malloc(sizeof(int)*rangeStats);
- a=0;
- while(menuloop4 == 1){
- dataRange=(int)nbAnswer+1;
- printf("\n\n|***************************Stats***************************|\n");
- printf("|Here you can have some statistics : |\n");
- printf("| |\n");
- printf("|1 Display the average of the evaluation |\n");
- printf("|2 Display the mark of each student |\n");
- printf("|3 Display the class of each student |\n");
- printf("|4 Display the best student |\n");
- printf("|5 Display the most successful question |\n");
- printf("|6 Display the less successful question |\n");
- printf("|7 Display the number of good answers for each question |\n");
- printf("|8 Exit |\n");
- printf("| |\n");
- printf("| |\n");
- printf("|***********************************************************|\n");
- printf("\n\nGo to : ");
- scanf("%lf",&underMenu4);
- system("cls");
- while((int)underMenu4<=0 || (int)underMenu4>9){
- printf("Error, please enter a correct value : ");
- scanf("%lf",&underMenu4);
- system("cls");
- }
- switch((int)underMenu4){
- case 1:{ // INITIALISATION OF THE AVERAGE AND ALL OTHER STATS
- mark = 0;
- if(initStats==1){
- printf("\n\nThe average is %.2lf \n\n",average);
- break;
- }
- for(i=0;i<=valueStudent;i++){
- if(i%((int)nbAnswer+1)==0){
- if(j==(int)nbAnswer){
- statsArray[dataRange]=mark;
- dataRange++;
- }
- average=average+mark;
- mark = 0;
- j=0;
- statsArray[dataRange]=studentArray[i];
- dataRange++;
- }
- if(i%((int)nbAnswer+1)!=0){
- if(studentArray[i]==answerArray[j]){
- mark++;
- }
- j++;
- }
- }
- average=average/(int)nbStudent;
- printf("\n\nThe average is : %.2lf \n\n",average);
- initStats = 1;
- break;
- }
- case 2:{ // SPECIFIC STUDENT STATS
- if(initStats==0){
- printf("\n\nPlease initialize the statistics with the average first !\n\n");
- break;
- }
- mark = 0;
- for(i=0;i<=valueStudent;i++){
- if(i%((int)nbAnswer+1)==0){
- if(j==(int)nbAnswer){
- printf("\n\nThe student %d got a mark of : %d\n\n",statsArray[dataRange-1],statsArray[dataRange]);
- dataRange++;
- }
- j=0;
- dataRange++;
- }
- if(i%((int)nbAnswer+1)!=0){
- if(studentArray[i]==answerArray[j]){
- mark++;
- }
- j++;
- }
- }
- break;
- }
- case 3:{ // EACH STUDENT STATS
- if(initStats==0){
- printf("\n\nPlease calculate the average before trying to get classes. It doesn't mean anything to get the class without the average anyway ...\n\n");
- break;
- }
- for(i=dataRange;i<rangeStats;i=i+2){
- class=statsArray[i+1]-(int)average;
- if(class>0){
- printf("\n\nThe student %d is at %c %d from the average\n\n",statsArray[i],43,class);
- }
- if(class<0){
- printf("\n\nThe student %d is at %c %d from the average\n\n",statsArray[i],45,class);
- }
- if(class == 0){
- printf("\n\nThe student %d is on the average\n\n",statsArray[i]);
- }
- }
- break;
- }
- case 4:{ // WORST AND BEST STUDENT
- if(initStats==0){
- printf("\n\nPlease initialize the statistics with the average first !\n\n");
- break;
- }
- min=statsArray[dataRange+1];
- minStudent=statsArray[dataRange];
- for(i=dataRange;i<rangeStats-1;i=i+2){
- if(statsArray[i+1]>max){
- max=statsArray[i];
- maxStudent=statsArray[i+1];
- }
- if(statsArray[i+1]<min){
- min=statsArray[i];
- minStudent=statsArray[i+1];
- }
- }
- printf("\n\nThe best student is the number %d with a mark of %d !\n",max,maxStudent);
- printf("The worst student is the number %d with a mark of %d !\n\n",min,minStudent);
- break;
- }
- case 5:{
- if(initStats==0){ // STATS MAX
- printf("\n\nPlease initialize the statistics with the average first !\n\n");
- break;
- }
- for(i=1;i<=(int)nbAnswer;i++){
- statsArray[i] = 0;
- }
- for(i=0;i<=valueStudent;i++){
- if(i%((int)nbAnswer+1)==0){
- j=0;
- }
- if(i%((int)nbAnswer+1)!=0){
- if(studentArray[i]==answerArray[j]){
- statsArray[j+1]++;
- }
- j++;
- }
- }
- for(i=1;i<=(int)nbAnswer;i++){
- if((int)max<(int)statsArray[i]){
- max=statsArray[i];
- maxIndex=i;
- }
- }
- printf("\n\nThe most successful question is the number %d\n\n",maxIndex);
- break;
- }
- case 6:{ // STATS MIN
- if(initStats==0){
- printf("\n\nPlease initialize the statistics with the average first !\n\n");
- break;
- }
- min = statsArray[1];
- for(i=1;i<=(int)nbAnswer;i++){
- statsArray[i] = 0;
- }
- for(i=0;i<=valueStudent;i++){
- if(i%((int)nbAnswer+1)==0){
- j=0;
- }
- if(i%((int)nbAnswer+1)!=0){
- if(studentArray[i]==answerArray[j]){
- statsArray[j+1]++;
- }
- j++;
- }
- }
- for(i=1;i<=(int)nbAnswer;i++){
- if((int)min>(int)statsArray[i]){
- min=i;
- }
- }
- printf("\n\nThe less successful question is the number %d\n\n",min);
- break;
- }
- case 7:{ // STATS NUMBER OF GOOD ANSWERS
- if(initStats==0){
- printf("\n\nPlease initialize the statistics with the average first !\n\n");
- break;
- }
- for(i=1;i<=(int)nbAnswer;i++){
- printf("\n\nThe question %d as %d good answers !\n\n",i,statsArray[i]);
- }
- break;
- }
- case 8:{
- menuloop4=0;
- break;
- }
- }
- }
- break;
- }
- case 6:{ // INITIATION OF THE ARRAY
- if(init == 1 || initAnswer == 1){
- printf("Please, reset the array before trying to generate an other one !");
- break;
- }
- printf("|*********************Array********************|\n");
- printf("| |\n");
- printf("|Would you like to load a random array ? [1] |\n");
- printf("|Or load a pre-completed array ? [0] |\n");
- printf("| |\n");
- printf("|**********************************************|\n");
- printf("\n\nChoice : ");
- scanf("%lf",&underMenu3);
- system("cls");
- while((int)underMenu3<0 || (int)underMenu3>2){
- printf("Error, please enter a correct value : ");
- scanf("%lf",&underMenu3);
- system("cls");
- }
- switch((int)underMenu3){
- case 1:{ // RANDOM EVERYTHING !
- nbAnswer = rand()%91+10;
- answerArray = malloc(sizeof(int)*(int)nbAnswer);
- nbStudent = rand()%501+1;
- valueStudent = ((int)nbAnswer+1)*(int)nbStudent;
- studentArray = malloc(sizeof(int)*valueStudent);
- for(i=0;i<valueStudent;i++){
- if(i%((int)nbAnswer+1)==0){
- studentNumber=rand();
- while(studentNumber/10000<1){
- studentNumber=rand();
- }
- studentArray[i]=studentNumber;
- }
- if(i%((int)nbAnswer+1)!=0){
- studentArray[i]=rand()%5+1;
- }
- }
- init = 1;
- initAnswer = 1;
- break;
- }
- case 0:{ // PRE-LOADED ARRAY
- nbAnswer=10;
- answerArray = malloc(sizeof(int)*(int)nbAnswer);
- nbStudent = 10;
- valueStudent = ((int)nbAnswer+1)*(int)nbStudent;
- studentArray = malloc(sizeof(int)*valueStudent);
- answerArray[0]=1;
- answerArray[1]=2;
- answerArray[2]=3;
- answerArray[3]=4;
- answerArray[4]=5;
- answerArray[5]=4;
- answerArray[6]=3;
- answerArray[7]=2;
- answerArray[8]=1;
- answerArray[9]=5;
- studentArray[0]=12345;
- studentArray[1]=1;
- studentArray[2]=2;
- studentArray[3]=3;
- studentArray[4]=4;
- studentArray[5]=5;
- studentArray[6]=5;
- studentArray[7]=4;
- studentArray[8]=2;
- studentArray[9]=3;
- studentArray[10]=1;
- studentArray[11]=12340;
- studentArray[12]=1;
- studentArray[13]=4;
- studentArray[14]=5;
- studentArray[15]=2;
- studentArray[16]=5;
- studentArray[17]=4;
- studentArray[18]=4;
- studentArray[19]=2;
- studentArray[20]=1;
- studentArray[21]=1;
- studentArray[22]=54121;
- studentArray[23]=1;
- studentArray[24]=2;
- studentArray[25]=3;
- studentArray[26]=4;
- studentArray[27]=5;
- studentArray[28]=5;
- studentArray[29]=4;
- studentArray[30]=2;
- studentArray[31]=3;
- studentArray[32]=1;
- studentArray[33]=13245;
- studentArray[34]=5;
- studentArray[35]=2;
- studentArray[36]=2;
- studentArray[37]=4;
- studentArray[38]=1;
- studentArray[39]=5;
- studentArray[40]=4;
- studentArray[41]=1;
- studentArray[42]=3;
- studentArray[43]=1;
- studentArray[44]=14225;
- studentArray[45]=2;
- studentArray[46]=2;
- studentArray[47]=2;
- studentArray[48]=4;
- studentArray[49]=1;
- studentArray[50]=5;
- studentArray[51]=4;
- studentArray[52]=1;
- studentArray[53]=2;
- studentArray[54]=1;
- studentArray[55]=23545;
- studentArray[56]=4;
- studentArray[57]=2;
- studentArray[58]=2;
- studentArray[59]=1;
- studentArray[60]=1;
- studentArray[61]=5;
- studentArray[62]=2;
- studentArray[63]=1;
- studentArray[64]=4;
- studentArray[65]=1;
- studentArray[66]=14545;
- studentArray[67]=4;
- studentArray[68]=4;
- studentArray[69]=5;
- studentArray[70]=1;
- studentArray[71]=1;
- studentArray[72]=5;
- studentArray[73]=2;
- studentArray[74]=2;
- studentArray[75]=5;
- studentArray[76]=1;
- studentArray[77]=11111;
- studentArray[78]=2;
- studentArray[79]=2;
- studentArray[80]=2;
- studentArray[81]=2;
- studentArray[82]=1;
- studentArray[83]=5;
- studentArray[84]=3;
- studentArray[85]=1;
- studentArray[86]=4;
- studentArray[87]=4;
- studentArray[88]=22522;
- studentArray[89]=2;
- studentArray[90]=3;
- studentArray[91]=5;
- studentArray[92]=2;
- studentArray[93]=1;
- studentArray[94]=1;
- studentArray[95]=3;
- studentArray[96]=1;
- studentArray[97]=4;
- studentArray[98]=4;
- studentArray[99]=23345;
- studentArray[100]=1;
- studentArray[101]=1;
- studentArray[102]=1;
- studentArray[103]=2;
- studentArray[104]=1;
- studentArray[105]=5;
- studentArray[106]=4;
- studentArray[107]=1;
- studentArray[108]=4;
- studentArray[109]=4;
- init = 1;
- initAnswer = 1;
- break;
- }
- }
- break;
- }
- case 7:{ // RESET THE ARRAY
- if(initAnswer == 0 && init == 0){
- printf("\n\nThere is nothing to reset. Please, try to focus !\n\n");
- break;
- }
- if(initAnswer == 1 && init == 0){
- free(answerArray);
- free(statsArray);
- initAnswer=0;
- printf("\n\nThe answers have been reseted !\n\n");
- break;
- }
- if(initAnswer == 0 && init == 1){
- free(studentArray);
- free(statsArray);
- init = 0;
- printf("\n\nthe students have been reseted !\n\n");
- break;
- }
- if(initAnswer == 1 && init == 1){
- free(answerArray);
- free(studentArray);
- free(statsArray);
- printf("\n\nThe array has been reseted !\n\n");
- init = 0;
- initAnswer = 0;
- break;
- }
- }
- case 8:{ // QUITE MENU
- menuloop=0;
- break;
- }
- }
- }
- printf("\n\n\n********* Would you like to restart the program ? Press [1/0] *********\n\n");
- printf("/!\\ Any error will close the program /!\\ \n\n");
- printf("Choice : ");
- scanf("%lf",&answer);
- system("cls");
- free(statsArray);
- free(answerArray);
- free(studentArray);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement