DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C (http://www.daniweb.com/forums/forum118.html)
-   -   Fatal Error C010? (http://www.daniweb.com/forums/thread13425.html)

coppernicus Nov 3rd, 2004 11:00 am
Fatal Error C010?
 
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.

// Weighted Average program
// Written by Will Styers CIS115-01

#using <mscorlib.dll>
using namespace System;

int main()
{
        //declaration of variables
        int test1        = 0;
        int test2        = 0;
        int test3        = 0;
        int lab1        = 0;
        int lab2        = 0;
        int lab3        = 0;
        int lab4        = 0;
        int lab5        = 0;
        int exam        = 0;
        int avgt        = 0;
        int avgl        = 0;
        int finalAverage = 0;

        //asking for user input

        Console::Write("Enter first test:");
        test1 = Console::ReadLine();
        Console::Write("Enter second test:");
        test2 = Console::ReadLine();
        Console::Write("Enter third test:");
        test3 = Console::ReadLine();
        Console::Write("Enter first lab:");
        lab1 = Console::ReadLine();
        Console::Write("Enter second lab:");
        lab2 = Console::ReadLine();
        Console::Write("Enter third lab:");
        lab3 = Console::ReadLine();
        Console::Write("Enter fourth lab:");
        lab4 = Console::ReadLine();
        Console::Write("Enter fifth lab:");
        lab5 = Console::ReadLine();
        Console::Write("Enter final exam:");
        exam = Console::ReadLine();

        //Equations

        avgt = (test1 + test2 + test3)/3;
        avgl = (lab1 + lab2 + lab3 + lab4 + lab5)/5;
        finalAverage = (avgt * .30) + (avgl * .50) + (exam * .20);

        //output statement

        Console::WriteLine("The final average is {0}.",Convert::ToString(finalAverage));

        return 0;
}        //End main function

frrossk Nov 3rd, 2004 11:24 am
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.

coppernicus Nov 3rd, 2004 11:50 am
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.

frrossk Nov 3rd, 2004 12:04 pm
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.

coppernicus Nov 3rd, 2004 12:58 pm
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?

frrossk Nov 3rd, 2004 2:10 pm
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)


All times are GMT -4. The time now is 3:31 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC