|
-
Jan 6th, 2006, 11:32 AM
#1
Thread Starter
New Member
C++ School Final Project
My teacher asked me to post on this forum for help on my program. I am currently Using Microsoft Visual C++ 6.0 I keep on getting three errors on the first line of my first function. The code is:
/* Daniel Gonzalez
Start Date: 01/03/06
Due Date: 1/11/06
This program calculates a person's average in a class
It works by asking the person to input the name of x number categories and how much each is worth**.
It then asks the person to input how many grades are to be inputed under each category** */
//--------------------------------------------------------------------------------------
#include <iostream.h >
#include <math.h>
#include <apstring.cpp>
double average01;
double average02;
double average03;
double average04;
double average05;
double average06;
double average07;
double average08;
double average09;
//--------------------------------------------------------------------------------------
void cat01(int 1,2,3,4,5,6,7,8,9,addition,average,y,numgrade
/* Gets the average of up to 9 numbers worth x% of the grade */
{
cout << "Enter the amount of grades ";
cin >> numgrade;
y=0;
while (numgrade >0 )
{
cin >> 1;
y++;
numgrade--;
cin >> 2;
y++;
numgrade--;
cin >> 3;
y++;
numgrade--;
cin >> 4;
y++;
numgrade--;
cin >> 5;
y++;
numgrade--;
cin >> 6;
y++;
numgrade--;
cin >> 7;
y++;
numgrade--;
cin >> 8;
y++;
numgrade--;
cin >> 9;
y++;
numgrade--;
}
addition= 1+2+3+4+5+6+7+8+9;
average01= addition/y;
}
//--------------------------------------------------------------------------------------
-------------------------------------------------------------------------
Note: I omitted Functions 2-9 because it is the exact same code with the number on the catnumber and the average number being different
--------------------------------------------------------------------------
/* The above are a series of functions that are to be called in main. THey are all the same.
They work by inting 9 variables it then asks the user for how many grades there are
It then takes the grades and each time it subracts one from the amount until it reaches 0
thus terminating the loop. At the same time, it adds one to the variable y which is then used
to keep track of how many it should divide by to get the average. Note that in the Addition part
of all the grades all the numbers are included because if the loop terminates early, it does not
take into account the other variables */
//--------------------------------------------------------------------------------------
void main()
{
apstring cat1;
apstring cat2;
apstring cat3;
apstring cat4;
apstring cat5;
apstring cat6;
apstring cat7;
apstring cat8;
apstring cat9;
double numcat;
double numper;
double funcnum;
double percent1;
double percent2;
double percent3;
double percent4;
double percent5;
double percent6;
double percent7;
double percent8;
double percent9;
char yn;
/* the above is the declaration of all the variables to be used in main.
Below is a do-while statment in order to allow the looping of the program.
Also, the getting of the categories,percents, and the calling of the functions
follows what was explained above in the functions where it subracts from the number of categories entered
thus making it so the while loop will have an end when it is properly named */
do {
cout << "Enter the amount of categories :";
cin >> numcat;
cout << "Enter the names of the categories : "<< endl;
while ( numcat >0 )
{
cin >> cat1;
numcat--;
cin >> cat2;
numcat--;
cin >> cat3;
numcat--;
cin >> cat4;
numcat--;
cin >> cat5;
numcat--;
cin >> cat6;
numcat--;
cin >> cat7;
numcat--;
cin >> cat8;
numcat--;
cin >> cat9;
numcat--;
}
cout << "Please re-enter the amount of categories ";
cin >> numper;
cout << "Enter how much of the percent is each category worth (in decimal form) : ";
while (numper > 0)
{
cin >> percent1;
numper--;
cin >> percent2;
numper--;
cin >> percent3;
numper--;
cin >> percent4;
numper--;
cin >> percent5;
numper--;
cin >> percent6;
numper--;
cin >> percent7;
numper--;
cin >> percent8;
numper--;
cin >> percent9;
numper--;
}
cout << "Please re-enter the amount of categories: ";
cin >> funcnum;
while (funcnum > 0) {
cat01();
funcnum--;
cat02();
funcnum--;
cat03();
funcnum--;
cat04();
funcnum--;
cat05();
funcnum--;
cat06();
funcnum--;
cat07();
funcnum--;
cat08();
funcnum--;
cat09();
funcnum--;
}
cout << "If you would like to continue type Y. If you would like to stop press N . "<;
cin >> yn;
} while (yn == 'Y' || yn == 'y');
if (yn == 'N' || yn == 'n')
cout << "Thank you for using Daniel Gonzalez's Grade Calculator!" << endl;
cout << "Have a nice day!" << endl;
}
/* Ask Mr. Morrel about calling just the average part from the function. Also check for problems.
At the end of the program give Letter grades like if 80<x> 89 cout B or something like that*/
-----------------------------------------------------------------------
The Errors are:
G://G:\Cpp files\d-gonfinal.cpp(22) : error C2143: syntax error : missing ')' before 'constant'
G:\Cpp files\d-gonfinal.cpp(22) : error C2143: syntax error : missing ';' before 'constant'
G:\Cpp files\d-gonfinal.cpp(22) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
d-gonfinal.obj - 3 error(s), 0 warning(s)
------------------------------------------------------------------------
Any help you could give me would be much appreciated.
Thanks,
Woomba
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|