![]() |
|
#1
|
|||
|
|||
A little help with some codeI am attempting to do a grade average program for class, and its my first one. So I know that there are tons of errors, so if you guys could pick the code apart and offer help, I would be most thankful
CPP / C++ / C Code:
Last edited by LuciWiz : 01-Feb-2005 at 01:26.
Reason: Please insert your C code between [c] & [/c] tags
|
|
#2
|
|||
|
|||
|
Quote:
The way it works is: 1. It's your assignment --- you should work through the errors and fix them. 2. If you have any specific questions about the errors (don't know what a particular error message means or don't understand why it's an error), post the exact error message (paste directly into the post). 3. If you have any specific questions about language constructs or usage: ask. 4. If something doesn't work the way you think it should: tell us what your input to the program was, what you expected to get, and what you got. Be specific. Regards, Dave |
|
#3
|
|||
|
|||
|
Sorry, I am looking at correcting this statment.
error C2296: '+' : illegal, left operand has type 'unsigned int (__cdecl *)(void)' for this line Code:
|
|
#4
|
|||
|
|||
|
Quote:
1. finalScore is the name of a function. 2. You can't declare a new variable with the same name. 3. Here's what the error message was more-or-less trying to say: When you use the name of a function in an expression, the compiler interprets it as a pointer to the location of the function. The address can't be used on the left hand side of an assignment (since it's constant and can't be changed by the program). Maybe you meant something like: CPP / C++ / C Code:
Note that in order to use this, the variables assignmentScores, examOne, and examTwo must be within the scope of the function finalScore(). The proper way to do this is to pass them as arguments. This is not BASIC (where traditionally everything is global), it's C. Regards, Dave |
|
#5
|
|||
|
|||
|
Thanks, I have it pretty much done except for one part:
'main' : missing storage-class or type specifiers This is my main here CPP / C++ / C Code:
I also recieve this warning. 'int ' : storage-class or type specifier(s) unexpected here; ignored These are my 'last' questions. Thanks!!! Last edited by LuciWiz : 26-Mar-2006 at 08:58.
Reason: Please insert your C++ code between [c++] & [/c++] tags
|
|
#6
|
|||
|
|||
|
Quote:
I don't see anything in this last code for main() that could cause these symptoms. The code in your first post had lots of problems. If you are now only getting these two messages, you must have changed quite a bit. I think you need to post your most recent complete code (assuming it's not too much bigger that our original). Regards, Dave |
|
#7
|
|||
|
|||
|
Quote:
you can't add return values of functions without calling the functions (which you are doing wrong). try this: CPP / C++ / C Code:
|
Recent GIDBlog
NARMY by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: Formatting C / C++ code | WaltP | C Programming Language | 1 | 06-Jan-2008 23:59 |
| Problem with int mixed with char,... | leitz | CPP / C++ Forum | 17 | 07-Dec-2004 20:56 |
| Help! Some basal questions about MFC | xutingnjupt | MS Visual C++ / MFC Forum | 1 | 05-Dec-2004 03:38 |
| very difficult code - program | gaurav_sting | CPP / C++ Forum | 1 | 16-Jun-2004 00:59 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The