what is the problem actually in my code?when debug ,it will crash or come out same data.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
int col;
int rand_question[3];
int confirm_question[3];
int i;
int score=0;
char choice;
int max_question, total_question;
max_question = 3;
total_question = 3;
srand(time(NULL));
/for(col=0 ; col < max_question ; col++)
{
if(col==0)
{
confirm_question[col] = rand() % total_question ;
}
else
{
do
{
rand_question[col] = rand() % total_question;
for(i=1 ; i < col ; i++)
{
if(rand_question[col] == confirm_question[i]||rand_question[col]==0)
{
break;
}
}
}while(rand_question[col] == confirm_question[i]);
confirm_question[col] = rand_question[col];
}
}
system("cls");
for(i=0; i<3; i++)
{
printf("%d\n",confirm_question[i]);
}
for(i=0; i<3; i++)
{
switch(confirm_question[i])
{
case 1:
score=quizquestion1();
break;
case 2:
score=quizquestion2();
break;
case 3:
score=quizquestion3();
break;
default:
printf("Nothing\n\n");
break;
}
}
printf("\t******************************************************************************\n");
printf("\t* Thanks for your answering Your final score are %d/10 \n\n *",score);
printf("\t******************************************************************************\n");
return 0;
}
1>c:\users\lenovo\documents\visual studio 2010\projects\chemquiz\chemquiz\quiz.c(33): error C2449: found '{' at file scope (missing function header?)
1>c:\users\lenovo\documents\visual studio 2010\projects\chemquiz\chemquiz\quiz.c(512): error C2059: syntax error : '}'
1> game.c
1>c:\users\lenovo\documents\visual studio 2010\projects\chemquiz\chemquiz\game.c(29): warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
1>c:\users\lenovo\documents\visual studio 2010\projects\chemquiz\chemquiz\game.c(64): error C2059: syntax error : 'return'