Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

need help about programming plzz

p_piyap_piya Member Posts: 4

hi i reall need help in this
i have no idea what's the problem but plzz help new in programming so have no clue.this is due this monday plzz reply as soon as possible.somebody tell me about this site and said this is really helpful so don't disappoint me.
thanks
in advance






/*
----------------------------------------------
Auther:
Created: 02/03/2004
Purpose: Output message to the screen
Amended:
----------------------------------------------
*/

//--- include header files -------------------

#include // stream I/O (cout, endl etc.)
#include // operating system console I/O routines

//--- main program-----------------------------------
void main()
{ // main program
// declare variables
int Correct;
int Incorrect;
char Answer;

// initialise
Correct = 0;
Incorrect = 0;
Answer = 0;

cout << "PP400 MULTIPLE CHOICE QUIZ" << endl;
cout << "==========================" << endl;
cout << endl << "Question 1 :" << endl;
cout << endl << "Which of the following is not a correct variable type?" << endl;
cout << endl << "A) float" << endl;
cout << "B) int" << endl;
cout << "C) double" << endl;
cout << "D) double" << endl;
cout << "E) None of the above" << endl;

cout << endl << "ENTER ANSWER :" << endl;

cin >> Answer; endl;
if ( Answer == 'B' || Answer == 'b')

{
cout << endl << "CORRECT ANSWER-WELL DONE!";
Correct = Correct + 1;
}
else
{
cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
}

cout << endl << "Question 2 :" << endl;
cout << endl << "Which of the following is the correct operator to compare two variables?" << endl;
cout << endl << "A) :=" << endl;
cout << "B) =" << endl;
cout << "C) equal" << endl;
cout << "D) ==" << endl;
cout << "E) None of the above" << endl;

cout << endl << "ENTER ANSWER :" << endl;

cin >> Answer; endl;
if ( Answer == 'D' || Answer == 'd')

{
cout << endl << "CORRECT ANSWER-WELL DONE!";
Correct = Correct + 1;
}
else
{
cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
}

cout << endl << "Question 3 :" << endl;
cout << endl << "Which of the following is the boolean operator gor logical and?" << endl;
cout << endl << "A) &" << endl;
cout << "B) &&" << endl;
cout << "C) |" << endl;
cout << "D) |&" << endl;
cout << "E) None of the above" << endl;

cout << endl << "ENTER ANSWER :" << endl;

cin >> Answer; endl;
if ( Answer == 'B' || Answer == 'b')

{
cout << endl << "CORRECT ANSWER-WELL DONE!";
Correct = Correct + 1;
}
else
{
cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
}



cout << endl << "Question 4 :" << endl;
cout << endl << "What punctuation ends most lines of C++ code?" << endl;
cout << endl << "A) ." << endl;
cout << "B) ;" << endl;
cout << "C) :" << endl;
cout << "D) '&" << endl;
cout << "E) None of the above" << endl;

cout << endl << "ENTER ANSWER :" << endl;

cin >> Answer; endl;
if ( Answer == 'B' || Answer == 'b')

{
cout << endl << "CORRECT ANSWER-WELL DONE!";
Correct = Correct + 1;
}
else
{
cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
}

cout << endl << "Question 5 :" << endl;
cout << endl << "What is the only function all C++ programs must contain?" << endl;
cout << endl << "A) start()" << endl;
cout << "B) system()" << endl;
cout << "C) main()" << endl;
cout << "D) program()" << endl;
cout << "E) None of the above" << endl;

cout << endl << "ENTER ANSWER : " << endl;

cin >> Answer; endl;
if ( Answer == 'C' || Answer == 'c')

{
cout << endl << "CORRECT ANSWER-WELL DONE!";
Correct = Correct + 1;
}
else
{
cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
}

// processing
Incorrect = 5 - Correct;

cout << endl << endl << "PP400 MULTIPLE CHOICE QUIZ SUMMARY" << endl;
cout << "==================================" << endl;

cout << endl << "Incorrect Answers = 2" << endl;
cout << "Correct Answers = 3" << endl;
cout << endl << "END OF TEST" << endl;

getch(); // pause to view results
} // main program ends




Comments

  • dwgeblerdwgebler Member Posts: 190
    I have edited your code below and removed the obvious errors, but as you were so vague I cannot really say if I have solved all your problems.

    :
    : hi i reall need help in this
    : i have no idea what's the problem but plzz help new in programming so have no clue.this is due this monday plzz reply as soon as possible.somebody tell me about this site and said this is really helpful so don't disappoint me.
    : thanks
    : in advance
    :
    :
    :
    :
    :
    :
    : /*
    : ----------------------------------------------
    : Auther:
    : Created: 02/03/2004
    : Purpose: Output message to the screen
    : Amended:
    : ----------------------------------------------
    : */
    :
    : //--- include header files -------------------
    :
    : #include // stream I/O (cout, endl etc.)
    : #include // operating system console I/O routines
    :
    : //--- main program-----------------------------------
    : void main()
    : { // main program
    : // declare variables
    : int Correct;
    : int Incorrect;
    : char Answer;
    :
    : // initialise
    : Correct = 0;
    : Incorrect = 0;
    : Answer = 0;
    :
    : cout << "PP400 MULTIPLE CHOICE QUIZ" << endl;
    : cout << "==========================" << endl;
    : cout << endl << "Question 1 :" << endl;
    : cout << endl << "Which of the following is not a correct variable type?" << endl;
    : cout << endl << "A) float" << endl;
    : cout << "B) int" << endl;
    : cout << "C) double" << endl;
    : cout << "D) double" << endl;
    : cout << "E) None of the above" << endl;
    :
    : cout << endl << "ENTER ANSWER :" << endl;
    :
    : cin >> Answer;
    : if ( Answer == 'B' || Answer == 'b')
    :
    : {
    : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : Correct++;
    : }
    : else
    : {
    : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : }
    :
    : cout << endl << "Question 2 :" << endl;
    : cout << endl << "Which of the following is the correct operator to compare two variables?" << endl;
    : cout << endl << "A) :=" << endl;
    : cout << "B) =" << endl;
    : cout << "C) equal" << endl;
    : cout << "D) ==" << endl;
    : cout << "E) None of the above" << endl;
    :
    : cout << endl << "ENTER ANSWER :" << endl;
    :
    : cin >> Answer;
    : if ( Answer == 'D' || Answer == 'd')
    :
    : {
    : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : Correct++;
    : }
    : else
    : {
    : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : }
    :
    : cout << endl << "Question 3 :" << endl;
    : cout << endl << "Which of the following is the boolean operator gor logical and?" << endl;
    : cout << endl << "A) &" << endl;
    : cout << "B) &&" << endl;
    : cout << "C) |" << endl;
    : cout << "D) |&" << endl;
    : cout << "E) None of the above" << endl;
    :
    : cout << endl << "ENTER ANSWER :" << endl;
    :
    : cin >> Answer;
    : if ( Answer == 'B' || Answer == 'b')
    :
    : {
    : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : Correct++;
    : }
    : else
    : {
    : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : }
    :
    :
    :
    : cout << endl << "Question 4 :" << endl;
    : cout << endl << "What punctuation ends most lines of C++ code?" << endl;
    : cout << endl << "A) ." << endl;
    : cout << "B) ;" << endl;
    : cout << "C) :" << endl;
    : cout << "D) '&" << endl;
    : cout << "E) None of the above" << endl;
    :
    : cout << endl << "ENTER ANSWER :" << endl;
    :
    : cin >> Answer;
    : if ( Answer == 'B' || Answer == 'b')
    :
    : {
    : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : Correct++;
    : }
    : else
    : {
    : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : }
    :
    : cout << endl << "Question 5 :" << endl;
    : cout << endl << "What is the only function all C++ programs must contain?" << endl;
    : cout << endl << "A) start()" << endl;
    : cout << "B) system()" << endl;
    : cout << "C) main()" << endl;
    : cout << "D) program()" << endl;
    : cout << "E) None of the above" << endl;
    :
    : cout << endl << "ENTER ANSWER : " << endl;
    :
    : cin >> Answer;
    : if ( Answer == 'C' || Answer == 'c')
    :
    : {
    : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : Correct++;
    : }
    : else
    : {
    : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : }
    :
    : // processing
    : Incorrect = 5 - Correct;
    :
    : cout << endl << endl << "PP400 MULTIPLE CHOICE QUIZ SUMMARY" << endl;
    : cout << "==================================" << endl;
    :
    : cout << endl << "Incorrect Answers = 2" << endl;
    : cout << "Correct Answers = 3" << endl;
    : cout << endl << "END OF TEST" << endl;
    :
    : getch(); // pause to view results
    : } // main program ends
    :
    :
    :
    :
    :

  • p_piyap_piya Member Posts: 4


    hi thanks for ur help but i want to know how to make it calculate automatically like when it should display automatically how many ans are true can u plzz tell so.
    thanks again



    : I have edited your code below and removed the obvious errors, but as you were so vague I cannot really say if I have solved all your problems.
    :
    : :
    : : hi i really need help in this
    : : i have no idea what's the problem but plzz help new in programming so have no clue.this is due this monday plzz reply as soon as possible.somebody tell me about this site and said this is really helpful so don't disappoint me.
    : : thanks
    : : in advance
    : :
    : :
    : :
    : :
    : :
    : :
    : : /*
    : : ----------------------------------------------
    : : Auther:
    : : Created: 02/03/2004
    : : Purpose: Output message to the screen
    : : Amended:
    : : ----------------------------------------------
    : : */
    : :
    : : //--- include header files -------------------
    : :
    : : #include // stream I/O (cout, endl etc.)
    : : #include // operating system console I/O routines
    : :
    : : //--- main program-----------------------------------
    : : void main()
    : : { // main program
    : : // declare variables
    : : int Correct;
    : : int Incorrect;
    : : char Answer;
    : :
    : : // initialise
    : : Correct = 0;
    : : Incorrect = 0;
    : : Answer = 0;
    : :
    : : cout << "PP400 MULTIPLE CHOICE QUIZ" << endl;
    : : cout << "==========================" << endl;
    : : cout << endl << "Question 1 :" << endl;
    : : cout << endl << "Which of the following is not a correct variable type?" << endl;
    : : cout << endl << "A) float" << endl;
    : : cout << "B) int" << endl;
    : : cout << "C) double" << endl;
    : : cout << "D) double" << endl;
    : : cout << "E) None of the above" << endl;
    : :
    : : cout << endl << "ENTER ANSWER :" << endl;
    : :
    : : cin >> Answer;
    : : if ( Answer == 'B' || Answer == 'b')
    : :
    : : {
    : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : Correct++;
    : : }
    : : else
    : : {
    : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : }
    : :
    : : cout << endl << "Question 2 :" << endl;
    : : cout << endl << "Which of the following is the correct operator to compare two variables?" << endl;
    : : cout << endl << "A) :=" << endl;
    : : cout << "B) =" << endl;
    : : cout << "C) equal" << endl;
    : : cout << "D) ==" << endl;
    : : cout << "E) None of the above" << endl;
    : :
    : : cout << endl << "ENTER ANSWER :" << endl;
    : :
    : : cin >> Answer;
    : : if ( Answer == 'D' || Answer == 'd')
    : :
    : : {
    : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : Correct++;
    : : }
    : : else
    : : {
    : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : }
    : :
    : : cout << endl << "Question 3 :" << endl;
    : : cout << endl << "Which of the following is the boolean operator gor logical and?" << endl;
    : : cout << endl << "A) &" << endl;
    : : cout << "B) &&" << endl;
    : : cout << "C) |" << endl;
    : : cout << "D) |&" << endl;
    : : cout << "E) None of the above" << endl;
    : :
    : : cout << endl << "ENTER ANSWER :" << endl;
    : :
    : : cin >> Answer;
    : : if ( Answer == 'B' || Answer == 'b')
    : :
    : : {
    : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : Correct++;
    : : }
    : : else
    : : {
    : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : }
    : :
    : :
    : :
    : : cout << endl << "Question 4 :" << endl;
    : : cout << endl << "What punctuation ends most lines of C++ code?" << endl;
    : : cout << endl << "A) ." << endl;
    : : cout << "B) ;" << endl;
    : : cout << "C) :" << endl;
    : : cout << "D) '&" << endl;
    : : cout << "E) None of the above" << endl;
    : :
    : : cout << endl << "ENTER ANSWER :" << endl;
    : :
    : : cin >> Answer;
    : : if ( Answer == 'B' || Answer == 'b')
    : :
    : : {
    : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : Correct++;
    : : }
    : : else
    : : {
    : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : }
    : :
    : : cout << endl << "Question 5 :" << endl;
    : : cout << endl << "What is the only function all C++ programs must contain?" << endl;
    : : cout << endl << "A) start()" << endl;
    : : cout << "B) system()" << endl;
    : : cout << "C) main()" << endl;
    : : cout << "D) program()" << endl;
    : : cout << "E) None of the above" << endl;
    : :
    : : cout << endl << "ENTER ANSWER : " << endl;
    : :
    : : cin >> Answer;
    : : if ( Answer == 'C' || Answer == 'c')
    : :
    : : {
    : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : Correct++;
    : : }
    : : else
    : : {
    : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : }
    : :
    : : // processing
    : : Incorrect = 5 - Correct;
    : :
    : : cout << endl << endl << "PP400 MULTIPLE CHOICE QUIZ SUMMARY" << endl;
    : : cout << "==================================" << endl;
    : :
    : : cout << endl << "Incorrect Answers = 2" << endl;
    : : cout << "Correct Answers = 3" << endl;
    : : cout << endl << "END OF TEST" << endl;
    : :
    : : getch(); // pause to view results
    : : } // main program ends
    : :
    : :
    : :
    : :
    : :
    :
    :

  • dwgeblerdwgebler Member Posts: 190
    Well you've already done the calculations for that output. Instead of writing
    [code]
    cout << "Incorrect = 2" << endl;
    [/code]
    try
    [code]
    cout << "Incorrect = " << Incorrect << endl;
    [/code]

    :
    :
    : hi thanks for ur help but i want to know how to make it calculate automatically like when it should display automatically how many ans are true can u plzz tell so.
    : thanks again
    :
    :
    :
    : : I have edited your code below and removed the obvious errors, but as you were so vague I cannot really say if I have solved all your problems.
    : :
    : : :
    : : : hi i really need help in this
    : : : i have no idea what's the problem but plzz help new in programming so have no clue.this is due this monday plzz reply as soon as possible.somebody tell me about this site and said this is really helpful so don't disappoint me.
    : : : thanks
    : : : in advance
    : : :
    : : :
    : : :
    : : :
    : : :
    : : :
    : : : /*
    : : : ----------------------------------------------
    : : : Auther:
    : : : Created: 02/03/2004
    : : : Purpose: Output message to the screen
    : : : Amended:
    : : : ----------------------------------------------
    : : : */
    : : :
    : : : //--- include header files -------------------
    : : :
    : : : #include <iostream.h> // stream I/O (cout, endl etc.)
    : : : #include // operating system console I/O routines
    : : :
    : : : //--- main program-----------------------------------
    : : : void main()
    : : : { // main program
    : : : // declare variables
    : : : int Correct;
    : : : int Incorrect;
    : : : char Answer;
    : : :
    : : : // initialise
    : : : Correct = 0;
    : : : Incorrect = 0;
    : : : Answer = 0;
    : : :
    : : : cout << "PP400 MULTIPLE CHOICE QUIZ" << endl;
    : : : cout << "==========================" << endl;
    : : : cout << endl << "Question 1 :" << endl;
    : : : cout << endl << "Which of the following is not a correct variable type?" << endl;
    : : : cout << endl << "A) float" << endl;
    : : : cout << "B) int" << endl;
    : : : cout << "C) double" << endl;
    : : : cout << "D) double" << endl;
    : : : cout << "E) None of the above" << endl;
    : : :
    : : : cout << endl << "ENTER ANSWER :" << endl;
    : : :
    : : : cin >> Answer;
    : : : if ( Answer == 'B' || Answer == 'b')
    : : :
    : : : {
    : : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : : Correct++;
    : : : }
    : : : else
    : : : {
    : : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : : }
    : : :
    : : : cout << endl << "Question 2 :" << endl;
    : : : cout << endl << "Which of the following is the correct operator to compare two variables?" << endl;
    : : : cout << endl << "A) :=" << endl;
    : : : cout << "B) =" << endl;
    : : : cout << "C) equal" << endl;
    : : : cout << "D) ==" << endl;
    : : : cout << "E) None of the above" << endl;
    : : :
    : : : cout << endl << "ENTER ANSWER :" << endl;
    : : :
    : : : cin >> Answer;
    : : : if ( Answer == 'D' || Answer == 'd')
    : : :
    : : : {
    : : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : : Correct++;
    : : : }
    : : : else
    : : : {
    : : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : : }
    : : :
    : : : cout << endl << "Question 3 :" << endl;
    : : : cout << endl << "Which of the following is the boolean operator gor logical and?" << endl;
    : : : cout << endl << "A) &" << endl;
    : : : cout << "B) &&" << endl;
    : : : cout << "C) |" << endl;
    : : : cout << "D) |&" << endl;
    : : : cout << "E) None of the above" << endl;
    : : :
    : : : cout << endl << "ENTER ANSWER :" << endl;
    : : :
    : : : cin >> Answer;
    : : : if ( Answer == 'B' || Answer == 'b')
    : : :
    : : : {
    : : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : : Correct++;
    : : : }
    : : : else
    : : : {
    : : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : : }
    : : :
    : : :
    : : :
    : : : cout << endl << "Question 4 :" << endl;
    : : : cout << endl << "What punctuation ends most lines of C++ code?" << endl;
    : : : cout << endl << "A) ." << endl;
    : : : cout << "B) ;" << endl;
    : : : cout << "C) :" << endl;
    : : : cout << "D) '&" << endl;
    : : : cout << "E) None of the above" << endl;
    : : :
    : : : cout << endl << "ENTER ANSWER :" << endl;
    : : :
    : : : cin >> Answer;
    : : : if ( Answer == 'B' || Answer == 'b')
    : : :
    : : : {
    : : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : : Correct++;
    : : : }
    : : : else
    : : : {
    : : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : : }
    : : :
    : : : cout << endl << "Question 5 :" << endl;
    : : : cout << endl << "What is the only function all C++ programs must contain?" << endl;
    : : : cout << endl << "A) start()" << endl;
    : : : cout << "B) system()" << endl;
    : : : cout << "C) main()" << endl;
    : : : cout << "D) program()" << endl;
    : : : cout << "E) None of the above" << endl;
    : : :
    : : : cout << endl << "ENTER ANSWER : " << endl;
    : : :
    : : : cin >> Answer;
    : : : if ( Answer == 'C' || Answer == 'c')
    : : :
    : : : {
    : : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : : Correct++;
    : : : }
    : : : else
    : : : {
    : : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : : }
    : : :
    : : : // processing
    : : : Incorrect = 5 - Correct;
    : : :
    : : : cout << endl << endl << "PP400 MULTIPLE CHOICE QUIZ SUMMARY" << endl;
    : : : cout << "==================================" << endl;
    : : :
    : : : cout << endl << "Incorrect Answers = 2" << endl;
    : : : cout << "Correct Answers = 3" << endl;
    : : : cout << endl << "END OF TEST" << endl;
    : : :
    : : : getch(); // pause to view results
    : : : } // main program ends
    : : :
    : : :
    : : :
    : : :
    : : :
    : :
    : :
    :
    :

  • p_piyap_piya Member Posts: 4


    thanks but i have done this way and it works thanks anyways.i got ur mail late or may be i checked late about that time i already submitted it.anyways thanks.
    alot
    bye
    // processing
    Incorrect = 5 - Correct;

    cout << endl << endl << "TEST SUMAARY" << endl;
    cout << "************";
    cout << endl << endl << "PP400 MULTIPLE CHOICE QUIZ SUMMARY" << endl;
    cout << "==================================" << endl;
    cout << endl << "Incorrect Answers = ";
    cout << 5 << " - " << Correct << " = " << Incorrect << endl;
    cout << "Correct Answers = ";
    cout << 5 << " - " << Incorrect << " = " << Correct << endl;
    cout << endl << "END OF TEST" << endl;










    : Well you've already done the calculations for that output. Instead of writing
    : [code]
    : cout << "Incorrect = 2" << endl;
    : [/code]
    : try
    : [code]
    : cout << "Incorrect = " << Incorrect << endl;
    : [/code]
    :
    : :
    : :
    : : hi thanks for ur help but i want to know how to make it calculate automatically like when it should display automatically how many ans are true can u plzz tell so.
    : : thanks again
    : :
    : :
    : :
    : : : I have edited your code below and removed the obvious errors, but as you were so vague I cannot really say if I have solved all your problems.
    : : :
    : : : :
    : : : : hi i really need help in this
    : : : : i have no idea what's the problem but plzz help new in programming so have no clue.this is due this monday plzz reply as soon as possible.somebody tell me about this site and said this is really helpful so don't disappoint me.
    : : : : thanks
    : : : : in advance
    : : : :
    : : : :
    : : : :
    : : : :
    : : : :
    : : : :
    : : : : /*
    : : : : ----------------------------------------------
    : : : : Auther:
    : : : : Created: 02/03/2004
    : : : : Purpose: Output message to the screen
    : : : : Amended:
    : : : : ----------------------------------------------
    : : : : */
    : : : :
    : : : : //--- include header files -------------------
    : : : :
    : : : : #include <iostream.h> // stream I/O (cout, endl etc.)
    : : : : #include // operating system console I/O routines
    : : : :
    : : : : //--- main program-----------------------------------
    : : : : void main()
    : : : : { // main program
    : : : : // declare variables
    : : : : int Correct;
    : : : : int Incorrect;
    : : : : char Answer;
    : : : :
    : : : : // initialise
    : : : : Correct = 0;
    : : : : Incorrect = 0;
    : : : : Answer = 0;
    : : : :
    : : : : cout << "PP400 MULTIPLE CHOICE QUIZ" << endl;
    : : : : cout << "==========================" << endl;
    : : : : cout << endl << "Question 1 :" << endl;
    : : : : cout << endl << "Which of the following is not a correct variable type?" << endl;
    : : : : cout << endl << "A) float" << endl;
    : : : : cout << "B) int" << endl;
    : : : : cout << "C) double" << endl;
    : : : : cout << "D) double" << endl;
    : : : : cout << "E) None of the above" << endl;
    : : : :
    : : : : cout << endl << "ENTER ANSWER :" << endl;
    : : : :
    : : : : cin >> Answer;
    : : : : if ( Answer == 'B' || Answer == 'b')
    : : : :
    : : : : {
    : : : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : : : Correct++;
    : : : : }
    : : : : else
    : : : : {
    : : : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : : : }
    : : : :
    : : : : cout << endl << "Question 2 :" << endl;
    : : : : cout << endl << "Which of the following is the correct operator to compare two variables?" << endl;
    : : : : cout << endl << "A) :=" << endl;
    : : : : cout << "B) =" << endl;
    : : : : cout << "C) equal" << endl;
    : : : : cout << "D) ==" << endl;
    : : : : cout << "E) None of the above" << endl;
    : : : :
    : : : : cout << endl << "ENTER ANSWER :" << endl;
    : : : :
    : : : : cin >> Answer;
    : : : : if ( Answer == 'D' || Answer == 'd')
    : : : :
    : : : : {
    : : : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : : : Correct++;
    : : : : }
    : : : : else
    : : : : {
    : : : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : : : }
    : : : :
    : : : : cout << endl << "Question 3 :" << endl;
    : : : : cout << endl << "Which of the following is the boolean operator gor logical and?" << endl;
    : : : : cout << endl << "A) &" << endl;
    : : : : cout << "B) &&" << endl;
    : : : : cout << "C) |" << endl;
    : : : : cout << "D) |&" << endl;
    : : : : cout << "E) None of the above" << endl;
    : : : :
    : : : : cout << endl << "ENTER ANSWER :" << endl;
    : : : :
    : : : : cin >> Answer;
    : : : : if ( Answer == 'B' || Answer == 'b')
    : : : :
    : : : : {
    : : : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : : : Correct++;
    : : : : }
    : : : : else
    : : : : {
    : : : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : : : }
    : : : :
    : : : :
    : : : :
    : : : : cout << endl << "Question 4 :" << endl;
    : : : : cout << endl << "What punctuation ends most lines of C++ code?" << endl;
    : : : : cout << endl << "A) ." << endl;
    : : : : cout << "B) ;" << endl;
    : : : : cout << "C) :" << endl;
    : : : : cout << "D) '&" << endl;
    : : : : cout << "E) None of the above" << endl;
    : : : :
    : : : : cout << endl << "ENTER ANSWER :" << endl;
    : : : :
    : : : : cin >> Answer;
    : : : : if ( Answer == 'B' || Answer == 'b')
    : : : :
    : : : : {
    : : : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : : : Correct++;
    : : : : }
    : : : : else
    : : : : {
    : : : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : : : }
    : : : :
    : : : : cout << endl << "Question 5 :" << endl;
    : : : : cout << endl << "What is the only function all C++ programs must contain?" << endl;
    : : : : cout << endl << "A) start()" << endl;
    : : : : cout << "B) system()" << endl;
    : : : : cout << "C) main()" << endl;
    : : : : cout << "D) program()" << endl;
    : : : : cout << "E) None of the above" << endl;
    : : : :
    : : : : cout << endl << "ENTER ANSWER : " << endl;
    : : : :
    : : : : cin >> Answer;
    : : : : if ( Answer == 'C' || Answer == 'c')
    : : : :
    : : : : {
    : : : : cout << endl << "CORRECT ANSWER-WELL DONE!";
    : : : : Correct++;
    : : : : }
    : : : : else
    : : : : {
    : : : : cout << endl << "INCORRECT ANSWER-BETTER LUCK NEXT TIME";
    : : : : }
    : : : :
    : : : : // processing
    : : : : Incorrect = 5 - Correct;
    : : : :
    : : : : cout << endl << endl << "PP400 MULTIPLE CHOICE QUIZ SUMMARY" << endl;
    : : : : cout << "==================================" << endl;
    : : : :
    : : : : cout << endl << "Incorrect Answers = 2" << endl;
    : : : : cout << "Correct Answers = 3" << endl;
    : : : : cout << endl << "END OF TEST" << endl;
    : : : :
    : : : : getch(); // pause to view results
    : : : : } // main program ends
    : : : :
    : : : :
    : : : :
    : : : :
    : : : :
    : : :
    : : :
    : :
    : :
    :
    :

Sign In or Register to comment.