This is a read-only archive. No new posts or registrations. Privacy Page Still need help? Ask the volunteers at Geeks to Go, free.
Software

C++ - what is wrong with this code

2 min read

This thread's last reply is from . Advice, software, and links below may be out of date — treat specific steps and download links with caution.

//
// Program to convert temp from celsius degree
// units into fahrenheit degree units:
// fahrenheit - celsius * (212 - 32)/100 + 32
//
#include
#include
#include
using namespace std:

int main(int nNumberofArgs, char* pszArgs[]_
{

//enter the temperature in celsius
int celsius;
cout << "Enter the temperature in Celsius:";
cin >> celsius;

//calculate conversion factor for celsius
//to fahrenheit
int factor;
factor = 212 - 32;

//use converstion factor to convert celsius
// into fahrenheit values
int fahrenheit;
fahrenheit = factor * celsius/100 + 32;

// output the results (followed by a newline)
cout << "fahrenheit value is:";
cout << fahrenheit << end1;

//wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
}





^^^^


That's my code. Here is the error message;

http://img513.imageshack.us/img513/4844/cplus.jpg



Can anyone tell me what's wrong?

many thanks

//
// Program to convert temp from celsius degree
// units into fahrenheit degree units:
// fahrenheit - celsius * (212 - 32)/100 + 32
//
#include
#include
#include
using namespace std:

int main(int nNumberofArgs, char* pszArgs[]_
{

//enter the temperature in celsius
int celsius;
cout << "Enter the temperature in Celsius:";
cin >> celsius;

//calculate conversion factor for celsius
//to fahrenheit
int factor;
factor = 212 - 32;

//use converstion factor to convert celsius
// into fahrenheit values
int fahrenheit;
fahrenheit = factor * celsius/100 + 32;

// output the results (followed by a newline)
cout << "fahrenheit value is:";
cout << fahrenheit << end1;

//wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
}





^^^^


That's my code. Here is the error message;

http://img513.imageshack.us/img513/4844/cplus.jpg



Can anyone tell me what's wrong?

many thanks


Change:

using namespace std:

to:

using namespace std;

I have not verified that the rest of your code is correct. But that line is causing your error.

Change:

using namespace std:

to:

using namespace std;

I have not verified that the rest of your code is correct. But that line is causing your error.


thanks, i changed that now and went over my other errors;

End1 should have been endl

and pszArgs[]_ should have ended with )



works fine now :D

thanks

Still having this problem?

This topic is from the What the Tech archive and can't take new replies. Geeks to Go is an active, free help community run by volunteers. Post your question there and a person, not a bot, will work through it with you.

Ask on Geeks to Go →