College Tuition Program

I'm writing a program that finds that college tuition of any random student. I seem to be missing a semi colon in line 72

http://pastebin.com/RRJ76hkx is my source code

The error I keep getting is

C:\Users\Zachary\Desktop\C++\Program 1.cpp:
Error E2379 C:\Users\Zachary\Desktop\C++\Program 1.cpp 72: Statement missing ; in function main()

I found another post on this but he doesn't seem to understand that their is three major codes that need to be accounted for not two. Any help would be much appreciated.
I figured it out line 72 else doesn't need ()
if ( major == 'C' || 'c')

should be:

if ( major == 'C' || major == 'c')


similar for the other ones
Edit:

Also:
if ( credithours < credithour12 )

might not work always as expected, because of the way floating point is represented as binary fractions.

this will always fail:

1
2
float a = 0.1;  //  a == 0.09999997
if(10 * a == 1.0)  //fail == 0.99999997 


changing the type to double doesn't help - it just means there will be less numbers that fail.

You can use numeric_limits<double>epsilon - Google it.
Last edited on
This is wrong:
1
2
3
4
else ( major == 'N' || 'n')
{
	majorcode = 0 ;
}


the reason for this error is that, for else clauses, you cannot give a condition( else(....){} is wrong) it must be an else if, or an else without condition.

Correct code:
1
2
3
4
else
{
	majorcode = 0 ;
}


OR

1
2
3
4
else if ( major == 'N' || 'n')
{
	majorcode = 0 ;
}


Hope it HELPS!!!
Last edited on
@Aceix

Between the pair of us, we will give the right advice !!!! Cheers
Thanks for pointing out those other mistakes now I get to sleep for a couple hours then work :D
Topic archived. No new replies allowed.