944,111 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 4084
  • C RSS
Nov 3rd, 2004
0

Fatal Error C010?

Expand Post »
Ok Yes I admit it I'm a student with a homework problem but I'm using this forum as a last resort. I've already written the code and I can't find the error no matter how many times I look over it so I really just need a second set of eyes. Don't tell me how to fix it just tell me what line/lines it is in and I'll figure it out myself.

  1. // Weighted Average program
  2. // Written by Will Styers CIS115-01
  3.  
  4. #using <mscorlib.dll>
  5. using namespace System;
  6.  
  7. int main()
  8. {
  9. //declaration of variables
  10. int test1 = 0;
  11. int test2 = 0;
  12. int test3 = 0;
  13. int lab1 = 0;
  14. int lab2 = 0;
  15. int lab3 = 0;
  16. int lab4 = 0;
  17. int lab5 = 0;
  18. int exam = 0;
  19. int avgt = 0;
  20. int avgl = 0;
  21. int finalAverage = 0;
  22.  
  23. //asking for user input
  24.  
  25. Console::Write("Enter first test:");
  26. test1 = Console::ReadLine();
  27. Console::Write("Enter second test:");
  28. test2 = Console::ReadLine();
  29. Console::Write("Enter third test:");
  30. test3 = Console::ReadLine();
  31. Console::Write("Enter first lab:");
  32. lab1 = Console::ReadLine();
  33. Console::Write("Enter second lab:");
  34. lab2 = Console::ReadLine();
  35. Console::Write("Enter third lab:");
  36. lab3 = Console::ReadLine();
  37. Console::Write("Enter fourth lab:");
  38. lab4 = Console::ReadLine();
  39. Console::Write("Enter fifth lab:");
  40. lab5 = Console::ReadLine();
  41. Console::Write("Enter final exam:");
  42. exam = Console::ReadLine();
  43.  
  44. //Equations
  45.  
  46. avgt = (test1 + test2 + test3)/3;
  47. avgl = (lab1 + lab2 + lab3 + lab4 + lab5)/5;
  48. finalAverage = (avgt * .30) + (avgl * .50) + (exam * .20);
  49.  
  50. //output statement
  51.  
  52. Console::WriteLine("The final average is {0}.",Convert::ToString(finalAverage));
  53.  
  54. return 0;
  55. } //End main function
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
coppernicus is offline Offline
3 posts
since Nov 2004
Nov 3rd, 2004
0

Re: Fatal Error C010?

First, I think you should declare avgt, avgl and finalAverage as float or double. But could be useful if you specify what kind of error you get.
Reputation Points: 17
Solved Threads: 9
Posting Whiz in Training
frrossk is offline Offline
220 posts
since Sep 2004
Nov 3rd, 2004
0

Re: Fatal Error C010?

Hmm yeah you're probably right about the data types. I wasn't thinking. Here is the error message I got. I looked it up on Microsoft but to no avail.

fatal error C1010: unexpected end of file while looking for precompiled header directive

I forgot to slip that 1 in there in the thread title.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
coppernicus is offline Offline
3 posts
since Nov 2004
Nov 3rd, 2004
0

Re: Fatal Error C010?

Quote originally posted by coppernicus ...
Hmm yeah you're probably right about the data types. I wasn't thinking. Here is the error message I got. I looked it up on Microsoft but to no avail.

fatal error C1010: unexpected end of file while looking for precompiled header directive

I forgot to slip that 1 in there in the thread title.
Take a look on this: http://www.myserverproject.net/forum/viewtopic.php?t=35. Maybe it will help you.
Reputation Points: 17
Solved Threads: 9
Posting Whiz in Training
frrossk is offline Offline
220 posts
since Sep 2004
Nov 3rd, 2004
0

Re: Fatal Error C010?

Ok I read that thread and gave that a shot now it's not converting the String input in the Console::Readline statements to int. Usually it converts automatically. Will I have to typecast those now?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
coppernicus is offline Offline
3 posts
since Nov 2004
Nov 3rd, 2004
0

Re: Fatal Error C010?

According to MSDN, the Readline method returns a string, so I think you have to do the typecast - lab1 = Convert.ToInt (Console::Readline)
Reputation Points: 17
Solved Threads: 9
Posting Whiz in Training
frrossk is offline Offline
220 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: MERGED: Deleting duplicates in an array (plz help me out!!!!!!!)
Next Thread in C Forum Timeline: Limits 10 Per Page





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC