i have already read the (read me before posting),and have come to ask an assignment which was given to me yesterday.so, i really need your help on getting the answer to a question that says WRITE A C++ PROGRAM THAT CALCULATES THE GRADE OF A STUDENT AFTER ASKING THE GIVEN QUESTION WITH REGARD TO TIME.
THE PROGRAM MUST DO THE FOLLOWING:
1)IT MUST GIVE A QUESTION FIRST
2)IT MUST RECIEVE AN ANSWER FROM THE STUDENT WITH A TIME RANGE OF 30 SECONDS AND SAY YES IF THE ANSWER IS CORRECT WITH THE GIVEN TIME RANGE OR NO IF THE ANSWER IS FALSE WITH THE GIVEN TIME RANGE.
3)IT SHOULDNT ACCEPT THE ANSWER IF IT HAS BEEN ANSWERED AFTER 30 SECONDS,IT SHOULD RATHER SAY TIMES UP!
4)THE PROGRAM MUST FINALLY OUT PUT THE RESULT OF THE STUDENT AFTER COMPLETING 10 QUESTIONS AND GIVE A GRADE TO THE STUDENT.
THATS ALL, THANKS FOR HELPING TRY TO MAKE IT UP TO ME BY TOMORROW PLEASE.

Ezzaral commented: Um, no. Thanks for playing. -2
jonsca commented: Clue? -1
arkoenig commented: You may claim that you read "Read this before posting" but apparently you didn't get the part about not asking people to do your homework for you, or the part about using code tags. +0

Recommended Answers

All 5 Replies

We are not here to write your program for you, but we will help you if you show some effort, such as post the code you have already written.

It is a bad practice to use upper case letters in this fashion... It is equivalent to yelling..

We are not here to write your program for you, but we will help you if you show some effort, such as post the code you have already written.

ok i've already started doin the program except for some finishing touches.the program goes on as follows:

#include <iostream.h>
#include <string.h>
#include <iomanip.h>
#include <fstream.h>
#include <time.h>


void main()
{

ifstream quastion[3],answerr;
char oq[500];
int mark=0;
int counter=0,i=0;
clock_t ct,gt=10000;
char answer[3];
char an[3];
answerr.open ("c:\\quastion\\a1.txt");
quastion[0].open ("c:\\quastion\\q1.txt");
quastion[1].open ("c:\\quastion\\q2.txt");
quastion[2].open ("c:\\quastion\\q3.txt");
answerr>>an;


for (int k=0;k<3;k++)
{
    quastion[k].getline(oq,500);
    cout<<oq<<endl;
    cin>>answer[k];
    ct=clock();
    if (ct>gt)
        {
        counter=1;
        break;
        }
}

if (counter==1)
    cout<<"The time is up";

for(int z=0;z<3;z++)
    {
    cout<<endl<<z+1;
    if (an[z]==answer[z])
  { cout<<". correct\n";
    mark++;}
    else
    cout<<". wrong : the ansewr is "<<an[z]<<endl;
}


cout<<"yur mark is..";
cout<<mark;

}

i think i've got what i need just by my self.its really impressing from an amateur try to give your ideas on the job try to bring easier methods if possible.......

First void main is not standard. main should only return an int as per the ISO standard. Secondly all of your header files are deprecated. What compiler are you using? You might also want to change where you compare the user answer to the answer in the file. I would do it right after the user enters in there answer so they know right there if they got it wrong or not.

commented: Yup +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.