Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Need Help On Homework (http://www.velocityreviews.com/forums/t268298-need-help-on-homework.html)

 Allens Mail 07-13-2003 10:20 PM

Need Help On Homework

Help,
Due Mon
I cant find the error. Keeps saying illegal token } have gone though code
Code below
Thanks
Allen

//************************************************** ************************
*******
// This program calculates your GPA for grades that are entered for a
unknown *
// number of classes for a student. GPA is calculated by taking the grade
value *
// times the unit value to get points. Points and units are running totals
*
// A grade of Q will end the program and the GPA is calculated by dividing
the *
// total number of points divided by total number os units. *
//************************************************** ************************
*******

#include <iostream>
#include <iomanip>
using namespace std;

void main(void)
{

float GetUnits(float uVal);

//Declaration programmer information
const char MY_NAME[25]= "Allen Mecum"; //progrqammer name
const char SECTION[25]= "CIS 1A M W 8-11:35am"; //class section
const char DATE[11]="07/02/2003"; //current date
const char DUEDATE[11]="07/07/2003"; //due date

// User Enters Grade and Units for class.
cout << "\nName: "<<MY_NAME << "\n";
cout << "Section: " << SECTION << "\n";
cout << "Date: " << DATE << "\n";
cout << "Due date:" << DUEDATE << "\n\n\n";

cout << GetGrade << " and " << GetUnits;
}

//*********************************END
MAIN********************************************** ***

//Void Function GetGrade obtains input from the user and checks to see that
it is valid.
//It continues to prompt the user for a letter grade while the grade entered
is not
//an A, B, C, D, F or Q.

{

do
{

gradePoints=0; // resets Temp locations to 0

{
case 'a' :
break;
case 'b' :
break;
case 'c' :
break;
case 'd' :
break;
case 'f' :
break;
case 'q' :
break;
default : cout<<"***** INVAILD ENTRY *****\n\n";
break;
}

}
}
//***********************************END

//Void Function GetUnits obtains from the user and checks to see that it is
vailid.
//It continues to prompt the user for a unit valuse while the units are not
in
//the range 0.0-9.0

float GetUnits(float uVal)
{

do
{
cout << "Enter the unit value:";
cin >> uVal; //stores temp units for calculation

if (uVal<0.0 || uVal> 9.0)
{
cout<<"Invaild Entry";
}
else
{
return uVal;
}
}
}
//*************************************END
GetUnits****************************************** **

 Aggro 07-14-2003 05:52 AM

Re: Need Help On Homework

Allens Mail wrote:

> #include <iostream>
> #include <iomanip>
> using namespace std;
>
> void main(void)

int main()

> {
>
> float GetUnits(float uVal);

These should be outside main(). And before it also. Move these two lines
between "using namespace std;" and "int main()" and you should be ok

< Some code removed here >

> float GetUnits(float uVal)
> {
>
> do

while(1)

> {
> cout << "Enter the unit value:";
> cin >> uVal; //stores temp units for calculation
>
> if (uVal<0.0 || uVal> 9.0)
> {
> cout<<"Invaild Entry";
> }
> else
> {
> return uVal;
> }
> }
> }

I didn't check if anything else is wrong in the code. Just fixed it so
it would compile.

 All times are GMT. The time now is 07:38 PM.