Thread: compiler Error: unexpected end of file....

  1. #1
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331

    compiler Error: unexpected end of file....

    I don't see why its yelling at me, maybe u will.

    Heres the error from the compiler:

    --------------------Configuration: CheckBook2 - Win32 Debug--------------------
    Compiling...
    CheckBook2.cpp
    c:\program files\microsoft visual studio\myprojects\checkbook2\checkbook2.cpp(64) : fatal error C1010: unexpected end of file while looking for precompiled header directive
    Error executing cl.exe.

    CheckBook2.obj - 1 error(s), 0 warning(s)



    *****************************

    and heres the program....

    Code:
    /*	Steven Billington 
    	September 12, 2002
    	Program File: CheckBook2.cpp.cpp
    
    	This program is same as checkbook but converts all input of transtype to be a capital letter.
    */
    
    
    
    #include <iomanip.h>
    #include <iostream.h>
    #include <ctype.h>
    
    int main ()
    
    (
    
    	double startingbalance, endingbalance, transamount;
    	char transtype;
    
    	//Module for getting the data
    
    	cout <<"Enter the starting balance and press <enter>: ";
    
    	cin >>startingbalance;
    
    	cout <<"Enter the transaction type and press <enter>: ";
    
    	cin >>transtype;
    
    	toupper (transtype);
    
    	cout <<"Enter the transaction amount and press <enter>: ";
    
    	cin >>transamount;
    
    	//Module for performing calculations
    
    	{
    	if (transtype == 'D')
    		endingbalance = startingbalance + transamount;
    	else if (transtype == 'W')
    		endingbalance = startingbalance - transamount;
    	else
    		cout <<"You enterd an invalid transaction type."<<endl;
    		continue;
    	}
    
    	//Module for displaying results
    
    		cout <<setiosflags(ios::fixed | ios::showpoint | ios::right)<<setprecision(2);
    
    		cout <<endl;
    
    		cout <<"Starting Balance $"<<startingbalance<<endl;
    
    		cout <<"Transaction $"<<transamount<<transtype<<endl;
    
    		cout <<"Ending Balance $"<<endingbalance<<endl;
    
    	return 0;
    }

  2. #2
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    look at this part:

    Code:
    {
    	if (transtype == 'D')
    		endingbalance = startingbalance + transamount;
    	else if (transtype == 'W')
    		endingbalance = startingbalance - transamount;
    	else
    		cout <<"You enterd an invalid transaction type."<<endl;
    		continue;
    	}
    you have brackets wrapped around the outside of you if statement. also look at how your if - else if - else statement is written.

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Also to add....you cant use a continue statment without some sort of loop block....

    Where would it actually continue after that call?

  4. #4
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Put #include "stdafx.h" before all your other includes.

  5. #5
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    the stdafx.h was a big problem the compiler wanted it removed so i did.

    Also the error comes up with/wo those curl braces on the if.

    i'm new to the conyinue i added a while(1) but it didn't fix it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  2. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM