Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is wrong with my code? 1

Status
Not open for further replies.

SurvivorTiger

Programmer
Jul 9, 2002
265
US
Hi everyone,
This is just a simple win32 console application. When i try to build this project i get the following message:

fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.

Here is my code:

Code:
/*Conversion.c -- Currency conversion*/

#include<stdio.h>

int main(void)

{

float dollar; /* US dollar amount */

float canada; /* Canada equivalent */

float britian; /* Britian equivalent */

float euro; /* Euro equivalent */

float turkey; /* Turkey equivalent */

float australia; /* Australia equivalent */

printf("Currency Conversion\n");

printf("Get the currencies for Canada, Britian, Euro, Tureky,Australia dollars\n");

printf("Please enter your amount in US dollars: $");

 

/*get input from the user*/

scanf("%f", &dollar);

/*dollar amount is multiplied by the currency conversion amount*/

canada = dollar * 1.4579811639700555421395798116397;

britian = dollar * .26409373554653373760213782825428;

euro = dollar * 0.55427337701012507444907683144729;

turkey = dollar * .388889000000;

australia = dollar * 1.6679581557535838822161952731499;

printf("Your dollar amount is worth $%.2f. in Canada\n", canada);

printf("Your dollar amount is worth $%.3f. in Britian\n", britian);

printf("Your dollar amount is worth $%.4f. in Euro\n", euro);

printf("Your dollar amount is worth $%.5f. in Turkey\n", turkey);

printf("Your dollar amount is worth $%.6f. in Australia\n", australia);

return 0;

}

Can anyone tell me what's wrong?
Thanks in advance.

AIM: survivertiger
 
Follow this pattern (in VC++ 6 with project wizard):
1. Add more useful includes in stdafx.h (see TODO part)
2. Compile stdafx.cpp (and recompile after next adding;)
3. Go on...
StdAfx stuff makes precompiled headers OK...
 
There should be a space in between,

Code:
#include<stdio.h>

It should be,

Code:
#include <stdio.h>
 
Precompiled headers (like stdafx.h) are used to speed up builds for large projects with lots of includes. Since yours is a simple console app, you do not need precompiled headers. To turn them off:

VC++ 6.0
For an existing project, go to Project->Settings, select the C/C++ tab, change the category to Precompiled Headers, and select 'Not using precompiled headers'.

If you are making a new Win32 Console App project, make sure to select 'An empty project' in step 1.

VC++ 7.x (.NET)
For an existing project, go to Project->Project Properties, look for the Precompiled Headers option under C/C++ and turn it off. I don't remember the exact steps and don't have my .NET compiler in front of me, but you should be able to find it.

If you are making a new project, make sure to select 'Empty Project' or 'Blank Project' instead of Console Project so that it doesn't add unnecessary stuff to your code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top