![]() |
|
#1
|
|||
|
|||
In Need of Some Serious Help...compiling errors [C++]So i've been working on this code, but i've been getin all sorts of errors, and can't for the life of me understand why. I'm pretty new to C++ so be gentle...haha
the program is meant to create a grade sheet for a bunch of students with input of grades and names etc...It should also calculate the average of the grades. Trying to compile it only shows lots of errors i can't quite figure out. CPP / C++ / C Code:
Anybody who can provide help, it would be greatly appreciated, because i need to finish this pretty soon. Thanks in advance. |
|
#2
|
||||
|
||||
Re: In Need of Some Serious Help...compiling errors [C++]Hi,
Welcome to GIDForums. What compiler are you using? First using ".h" is depreciated in c++. remove the .h in all the includes. conio.h is not a standard library. So remove it also. And use <cmath> instead of math.h So, the include section is something like this: CPP / C++ / C Code:
Then , ignore the typedefs(only for a while) and write a simple program The typedef is the cause of all the confusion. The main function should be int main() rather than void main(). Regarding this: CPP / C++ / C Code:
To avoid this confusion, you could just write like this: CPP / C++ / C Code:
All of the errors come from this area: CPP / C++ / C Code:
And you should use a loop to calculate the average, rather than a single statement. Something like this: CPP / C++ / C Code:
Best Regards, Paramesh. __________________
Don't walk in front of me, I may not follow. Don't walk behind me, I may not lead. Just walk beside me and be my friend. |
|
#3
|
|||
|
|||
Re: In Need of Some Serious Help...compiling errors [C++]this is how it looks now. Btw, im using turbo c++ for this. I am still really confused about all the typedef's...any ideas? Here's the code as of right now...Also, i don't get what you mean by the .h is depreciated. I've used it on all my other progs so far with no problems.
Also, the conio.h is a turboc++ library part. Thanks for all your help! CPP / C++ / C Code:
|
|
#4
|
||||
|
||||
Re: In Need of Some Serious Help...compiling errors [C++]typedef introduce a new name for a type.
For example, consider this case: CPP / C++ / C Code:
As in your case, CPP / C++ / C Code:
First, you have created a typedef for string_30. But string_30 is again typedef(ed) to list_s30. Why this confusion? So, it is better to leave the typedef for a while. We'll switch over to typedef later.(After we complete the program) Regarding the depreciated libraries: Quote:
The ANSI C++ standard specifies the following modification:
It is not a part of the standard. I Know this is too much. If you are confused, just forget the 23 lines above. Now to the program: You need to make two changes: Delete the typedef lines for a while and Rewrite the whole program without the typedefs. ![]() (There is a whole bunch of errors, which cant be explained in text) Here is a start: 1. Whenever you use an array, you need a loop. Because grade[i] is different from grade. 2. I'm adding a little bit modification for the average variable. Declare the average as a float array, and compute average for each student. Regards, Paramesh __________________
Don't walk in front of me, I may not follow. Don't walk behind me, I may not lead. Just walk beside me and be my friend. |
|
#5
|
|||
|
|||
Re: In Need of Some Serious Help...compiling errors [C++]I ran the program and after fixing the things you mentioned, this is what it askedme for but it shouldnt have asked me for an extra student since i only entered 1...NEVERMIND, I FOUND THAT WE JUST NEEDED A < IN THE CODE, NOT A <=
" Course Grade Report =================== Professor: John Semester: Fall 2005 Course: Math Credits: 4 StudentMidtermFinalProjectAverageGrade ====================================== 0x22f9480x22fbc80x22fc480x22fcc8 93 5 Press any key to continue . . ." Here is my program code and I did the best to fix the corrections that you pointed out. CPP / C++ / C Code:
Also I did not change average to a float because the grades will al be whole numbers. I dont know how to make this program work without trying to use the typedefs and they are wutsmaking the problem. I think that I need a const int for the size of the letter grade but i am not sure how to make that a typedef. thanks for all your help. |
|
#6
|
|||
|
|||
Re: In Need of Some Serious Help...compiling errors [C++]I messed with the outfile to try and make it display properly but now the numbers are not showing properly only the average and the letter grade work.
here is what it looks like: CPP / C++ / C Code:
It should display more then one student but doesn't. Also I understand the general idea of the two dimensional array, I just don't quite understand which section I am suposed to make the change(s). |
|
#7
|
||||
|
||||
Re: In Need of Some Serious Help...compiling errors [C++]Quote:
Put this part under a loop: CPP / C++ / C Code:
Note that when you use two dimensional strings, you need a loop to print them out. The program still has errors, and you are online now, we'll correct them one by one. OK? Regards, Paramesh. __________________
Don't walk in front of me, I may not follow. Don't walk behind me, I may not lead. Just walk beside me and be my friend. |
|
#8
|
|||
|
|||
Re: In Need of Some Serious Help...compiling errors [C++]I'm confused. Is this what you mean?
CPP / C++ / C Code:
|
|
#9
|
||||
|
||||
Re: In Need of Some Serious Help...compiling errors [C++]No! Since you have changed some parts of the program.
Ok. here is the modification you have to do now: Change this first, and check whether you got it right: CPP / C++ / C Code:
Paramesh. __________________
Don't walk in front of me, I may not follow. Don't walk behind me, I may not lead. Just walk beside me and be my friend. |
|
#10
|
|||
|
|||
Re: In Need of Some Serious Help...compiling errors [C++]So this is what I have now:
CPP / C++ / C Code:
My problem is that now, the average and grade in the outfile are not being correctly computed. This is what it looks like. CPP / C++ / C Code:
|
Recent GIDBlog
Meeting the populace by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Winsock error when compiling FLTK 2.0 Projects | mauriciorossi | FLTK Forum | 3 | 16-Aug-2005 10:18 |
| C++ Compiling Error | pointer | MS Visual C++ / MFC Forum | 3 | 12-May-2005 04:08 |
| Compiling Errors | ToddSAFM | C++ Forum | 22 | 18-Dec-2004 11:42 |
| help to debug complier errors | nkhambal | C Programming Language | 3 | 04-Oct-2004 08:26 |
| Can somebody look at this and point out any errors to me | soulfly | C Programming Language | 7 | 31-Mar-2004 09:45 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The