Program Error??

#include <iostream>
using namespace std;

int main ( )
{
int nrPupilsAttended, mostInteresting;
float nrScarlett, nrRhett, nrAshley, nrMelanie, nrOther;

// Initialise
nrScarlett = 0;
nrRhett = 0;
nrAshley = 0;
nrMelanie = 0;
nrOther = 0;

// Loop
for ( int i = 1; i <= 3; i++)
{
cout << " Please enter the number of pupils that attended the show? ";
cin >> nrPupilsAttended;


for ( int i = 1; i <= nrPupilsAttended; i++)
{
cout << " Whom do you consider the most interesting character? ";
cin >> mostInteresting;

switch (mostInteresting)
{
case 1:
cout << "S for Scarlett" << endl;
break;
case 2:
cout << "R for Rhett" << endl;
break;
case 3:
cout << "A for Ashley" << endl;
break;
case 4;
cout << "M for Melanie" << endl;
break;
default:
cout << "Anything else for another actor" << endl;
}

}

}

cout << " The total for Scarlett is " << nrScarlett << endl;
cout << " The total for Rhett is " << nrRhett << endl;
cout << " The total for Ashley is " << nrAshley << endl;
cout << " The total for Melanie is " << nrMelanie << endl;
cout << "The total for another actor is " << nrOther << endl;

return 0;

}




I cant seem to compile this program???

closed account (z05DSL3A)
In the line 'case 4;' the ';' should be an ':'

TIP: When posting code, either click the insert code button and then paste your code between the two 'tags' or paste your code, then highlight it and then click the insert code button.
Last edited on
Topic archived. No new replies allowed.