473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need Help On Homework

Help,
Due Mon
I cant find the error. Keeps saying illegal token } have gone though code
and balance all French braces and parenthesis. Please help going crazy.
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)
{

int GetGrade(int gradePoints);
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";

//GetGradeVal*UnitVal=totalPoints
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.

int GetGrade(int gradePoints)
{
char grade;
const int GRADEA=4;
const int GRADEB=3;
const int GRADEC=2;
const int GRADED=1;
const int GRADEF=0;
do
{
cout << "Please enter you grade (A-F, 'Q' to quit):";
cin >> grade;

gradePoints=0; // resets Temp locations to 0

switch(grade)
{
case 'a' :
case 'A' : gradePoints=GRADEA;
break;
case 'b' :
case 'B' : gradePoints=GRADEB;
break;
case 'c' :
case 'C' : gradePoints=GRADEC;
break;
case 'd' :
case 'D' : gradePoints=GRADED;
break;
case 'f' :
case 'F' : gradePoints=GRADEF;
break;
case 'q' :
case 'Q' : gradePoints=0;
break;
default : cout<<"***** INVAILD ENTRY *****\n\n";
break;
}

}
while (grade!='Q' && grade!='q');
return gradePoints;
}
//***********************************END
GetGrade****************************************

//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****************************************** **
Jul 19 '05 #1
1 1712
Allens Mail wrote:
#include <iostream>
#include <iomanip>
using namespace std;

void main(void)
int main()
{

int GetGrade(int gradePoints);
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
Try this instead of 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.

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bobby | last post by:
Hello everyone I have a question. The school I am working for is in the beginning process of having a webpage that will direct students to download there homework and be able to view there info...
3
by: Bobby | last post by:
I asked around about my problem, but so far no one has replied to me so I dont know if its possible or maybe i was posting in the wronng groups. Ok well I have a asp script going on my works...
15
by: carr4895 | last post by:
Hello. I was wondering if someone could help me too with a login form. Upon startup, I have to display a password screen and it should accept a user name and password. User name can be anything...
1
by: simonalexander | last post by:
I have got a homework task to do and I have started the work but I cannot finish it.Can someone please help me finish the code. The help given is much appreciated. The actual specifications are...
31
by: Martin Jørgensen | last post by:
Hi, I've had a introductory C++ course in the spring and haven't programmed in C++ for a couple of months now (but I have been programmed in C since january). So I decided to do my conversion...
4
by: sara | last post by:
i am studying a computer engineering and i started taking programming using C++ since month i have question i think it`s easy for you all *prof.programmer* but it`s bit diffecult for me plzz i...
9
by: Kodiak | last post by:
I am trying to write some javascript code in which you enter some text in one text box and the text will also appear in the second text box. For example, if I write the word "Test" both text boxes...
30
by: carlos123 | last post by:
Ok I am working on a Hall Pass program for my computer programming class. There are 3 things that I am confused on. 1. Reading a file. 2. Taking that data read from the file and putting it into...
1
by: JoshPierce | last post by:
I want to allow users of my program to click File>Save and have a save dialog open and allow them to save all of their input. here is the background of my program. I have a program that allows...
8
by: garyrowell | last post by:
I have been at this programme for hours trying to work out what is wrong. Any help would be very much appricated. Here is the breif I received. The program This week you are going to write three...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.