Jump to content

Build Theme!
  •  
  • Infected?

WE'RE SURE THAT YOU'LL LOVE US!

Hey there! :wub: Looks like you're enjoying the discussion, but you're not signed up for an account. When you create an account, we remember exactly what you've read, so you always come right back where you left off. You also get notifications, here and via email, whenever new posts are made. You can like posts to share the love. :D Join 93115 other members! Anybody can ask, anybody can answer. Consistently helpful members may be invited to become staff. Here's how it works. Virus cleanup? Start here -> Malware Removal Forum.

Try What the Tech -- It's free!


Photo

C++ - what is wrong with this code


  • Please log in to reply
2 replies to this topic

#1 bizarrebob

bizarrebob

    Silver Member

  • Authentic Member
  • PipPipPip
  • 395 posts
  • Interests:Computers. Video games.

Posted 24 February 2009 - 01:21 PM

//
// Program to convert temp from celsius degree
// units into fahrenheit degree units:
// fahrenheit - celsius * (212 - 32)/100 + 32
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
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.images.../4844/cplus.jpg



Can anyone tell me what's wrong?

many thanks

Edited by bizarrebob, 24 February 2009 - 01:22 PM.

::: My Spec :::

Windows 7
Intel Core Duo @ 2.8ghz
4gb OCZ RAM @ 1066mhz
ATI 4870 512mb



The help you receive here is free. If you wish to show your appreciation, then you may donate to help keep us online

    Advertisements

Register to Remove


#2 appleoddity

appleoddity

    SuperMember

  • Tech Team
  • 3,071 posts
  • Interests:Eating, Movies, Family, Church, Music, Volleyball, Softball, Poker, Computers, Electronics, Reading.

Posted 24 February 2009 - 09:58 PM

//
// Program to convert temp from celsius degree
// units into fahrenheit degree units:
// fahrenheit - celsius * (212 - 32)/100 + 32
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
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.images.../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.

The help you have been given is free. If you have been happy with our help please consider donating to support this forum.

If you would like to say thanks for the help I have given you please View My Profile and Leave a Comment.
Your encouragement is welcome.


#3 bizarrebob

bizarrebob

    Silver Member

  • Authentic Member
  • PipPipPip
  • 395 posts
  • Interests:Computers. Video games.

Posted 25 February 2009 - 12:19 PM

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

::: My Spec :::

Windows 7
Intel Core Duo @ 2.8ghz
4gb OCZ RAM @ 1066mhz
ATI 4870 512mb



The help you receive here is free. If you wish to show your appreciation, then you may donate to help keep us online

Related Topics



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users