cppnewbie
Messages postés2Date d'inscriptionsamedi 10 décembre 2005StatutMembreDernière intervention12 décembre 2005
-
10 déc. 2005 à 22:17
Darkneon
Messages postés56Date d'inscriptionvendredi 18 mai 2001StatutMembreDernière intervention13 décembre 2005
-
13 déc. 2005 à 07:05
run the program please and let me know whats wrong wit it .. I'm receiving some crazy numbers at the end of the program. and on each line it should take only one letter .. but on mine it can take more and then it craches my code. and u can hit enter without putting a letter in .. that shouldn't be happening. so these are my problems. here is the code:
/* Alex Talbi
Problem statement: Make a program that asks the user to input a student's
answers for a DMV test. The program is to compares these
answers with a set of stored correct answers. If the
student recieved a 75% or better on the test, then the
program will return a message saying that the student
has passed the test.
Approach: I will start by making three different arrays for each category.
I will place the answer key in the first array and continue with
the second array for the input of answers and the result of
the inputed answers in the last array.
Input: Twenty numbers are inputed.
Process: Compare inputed answers with the correct answers. come up with a
percentage of correct answers.
Output: The percentage of the correct answers that the student earned.
Even if the student did not pass the test.*/
#include
#include
using namespace std;
int main()
{
const int array2=21, array1=20, Avg=15,
const1=0, const2=1, const3=7, const4=5;
int correct_answers = 0
char ansInp[array1],
ansRight[array2] = "BDAACABACDBCDADCCBDA";
int numBOOL[array1],
Wrong=0,
Right;
bool answrBOOL[array1];
cout <<"This program will grade your driver's license exam." <<endl;
cout <<"Enter your answers using either A, B, C, or D." <<endl;
for (int index=const1, loop=const1; index>ansInp[index];
while (ansInp[index]!='A' && ansInp[index]!='B' &&
ansInp[index]!='C' && ansInp[index]!='D' )
{
cout <<"Invalid entry. Enter A, B, C, or D."<<endl;
cin >>ansInp[index];
}
}