473,783 Members | 2,574 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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*Uni tVal=totalPoint s
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=GRA DEA;
break;
case 'b' :
case 'B' : gradePoints=GRA DEB;
break;
case 'c' :
case 'C' : gradePoints=GRA DEC;
break;
case 'd' :
case 'D' : gradePoints=GRA DED;
break;
case 'f' :
case 'F' : gradePoints=GRA DEF;
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 1730
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
1933
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 like test scores and etc(the homework and info page will reside on our webservers at the school on the local intranet network). Now what I need is a way for the students to go to a login page and when logging in will be automatically directed to...
3
1404
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 website. The script basically is a logon script that gives a default page for each user (in my jobs case our students). Now the script had code in it giving the admininstrator an oppurtunity to send users a text message about news and whathaveya to...
15
2290
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 non-blank. If there is no user name, an appropriate error message must be displayed. All of the following passwords are valid IT160, VB2Manager, BackDoor. No other password is valid. It must allow the user to enter the password in any case. If...
1
1941
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 here: The task for this project is to write a simulator program for a robot designed to move packages around in a warehouse environment. The input to your program (from standard input) will contain a map of the environment in its original...
31
3151
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 utility in C++, before I forget everything. But it doesn't compile: ------------
4
2513
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 need your help. (: this is the question: ** A new telephone communication company needs a billing calculation program. The cost of a call is based on the following three inputs that should be entered by the user, and they are explained as follows.
9
1311
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 should have the same word in them. I need to be able to see the work actually being typed out in both text boxes as well. If I trye the letter T then both text boxes should have the same result all the type. If I delete the letter T then both...
30
2309
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 an array. 3. A way to access the array, and check if it matches what the user inputed (like a login program) This is what the text file looks like (unless you have a easier / more efficient way of doing it, I was reading somewhere, about...
1
1485
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 students to calculate their grades as the class progresses. I want them to be able to type in their information and i already have the program written for them to be able to calculate everything via different types of work based on weights for homework...
8
29168
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 classes: Card.java, Deck.java and DeckTester.java. The specification for each class is given below. Card.Java This is a simple class that represents a playing card. Card has two attributes: • rank which is a String that represents the value...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10083
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.