varun wrote:thank you very much sir,it worked.please tell is there any way way i can track them them before it exits
Frankly, that program needed to be rewritten.

It was overly complex, you didn't need any of those structs, strcats, and arrays. Pretty much loops, if statements, and printf are all you need.
I've given you a head start with the rewrite, you just have to finish questions 3-10.
- Code: Select all
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspcallbacks.h>
#include <pspctrl.h>
#define printf pspDebugScreenPrintf //shorten that print function -- easy does it :p
PSP_MODULE_INFO("Quiz",0,1,1);
choice=0; //less variables, less headaches ^_^
points=0;
SceCtrlData pad;
/// FUNCTIONS
/////////////////////////
padinput() //checks for user input
{
choice=0;//keeps choice from repeating to next question
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CIRCLE)choice=4;
if(pad.Buttons & PSP_CTRL_CROSS)choice=3;
if(pad.Buttons & PSP_CTRL_SQUARE)choice=2;
if(pad.Buttons & PSP_CTRL_TRIANGLE)choice=1;
if(pad.Buttons & PSP_CTRL_START)choice=5;
if(pad.Buttons & PSP_CTRL_SELECT)choice=6;
};
scoring(int correct) //provides results from question and adds up score 'correct' is the correct choice
{ //(add it in the function itself, you'll see below)
if(choice==6)printf("Skipped!!");
if(choice==correct){printf("True...+3 points\n");
points+=3;}
if(choice!=correct&&choice!=6){
printf( "Wrong Answer..!!!, you get -1 points\n");
points--; //subtracts 1 point--shorthand for what you had before
printf("the correct answer was...\n");}
};
//main-------------------------------------------------------------------------------------------------------
int main() {
while(1){ //this loop keeps the entire program running until user wants to quit (start button)
pspDebugScreenInit();
pspDebugScreenClear();
SetupCallbacks();
points=0;
printf("Welcome to my quiz\n\n");
printf("The rules of the quiz are as follows-\n");
printf("*For each true answer you will get 3 points.\n");
printf("*For each wrong answer you will loose 1 point.\n");
printf("*You have to answer question by pressing a/A,b/B,c/C,d/D.\n");
printf("*You can quit the game any time by entering Start as your choice.\n");
printf("*You can skip the question by entering Select as your choice.\n\n\n");
//question 1
printf("By which of these nicknames is Nagpur also known as?\n\n");
printf("TRIANG Diamond City\n");
printf("SQUARE Orange City\n");
printf("CROSS Pink City\n");
printf("CIRCLE City of Lakes\n\n");
printf(" START Quit\n");
printf(" SELECT Skip\n");
while(1){ //small loop to wait and check for user response
padinput();
if(choice==5)sceKernelExitGame();
if(choice!=0)break;
}
scoring(2); //calculate and print question result -- choice '2' is correct
sleep(2);
pspDebugScreenClear();
//question 2
printf("Which pieces are maximum in number at the start of a chess game\n\n");
printf("TRIANG Rook\n");
printf("SQUARE Knight\n");
printf("CROSS Pawn\n");
printf("CIRCLE Bishop\n\n");
printf(" START Quit\n");
printf(" SELECT Skip\n");
while(1){
padinput();
if(choice==5)sceKernelExitGame();
if(choice!=0)break;
}
scoring(3);
sleep(2);
pspDebugScreenClear();
//questions 3-10 -- your job! :O
printf("\n\n\n\nQuiz finished \n"); //you can finish this part I hope?
printf("Number of questions you attemted = ?\n");
printf("Number of correct quetions = ?\n");
printf("Points = %d",points);
sleep(4);
}
}