This is a read-only archive. No new posts or registrations. Privacy Page
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.

Looking for the outcome? Ask AI

//
// 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

Ask AI

AI can make mistakes. Check the cited posts. Archived advice can be out-of-date

Don't include personal information. Questions and selected public posts go to OpenAI. About Ask AI