Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


New to c++

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
angerist
Grandmaster Cheater Supreme
Reputation: 0

Joined: 18 Jun 2007
Posts: 1011
Location: Australia.

PostPosted: Fri Apr 04, 2008 12:55 am    Post subject: New to c++ Reply with quote

Hey im new to c++ so im making my 2nd application after the helloword lol. I know im hell noob but i'd really like to learn. Thank you Smile.

Theres 1 error i've tried putting ; infront of celsius (all of them).

Code:
error C2146: syntax error : missing ';' before identifier 'celsius'



Source:
Code:
//
// Program to convert temperature from Celsius degree by julian
// 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 conversion 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 << endl;
// wait until user is ready before terminating program
// to allow the user to see the program results
system(“PAUSE”);
return 0;

_________________
Back to top
View user's profile Send private message
Deletion
I post too much
Reputation: 0

Joined: 22 Jun 2006
Posts: 2148
Location: Underground

PostPosted: Fri Apr 04, 2008 1:18 am    Post subject: Reply with quote

You don't have any brackets, your quotes are messed up.
Don't just copy and paste code >.>
“ <~~ This is not the same as ~~> "

_________________
Bitch, please.
redslothx wrote:
oh im a man so respect the penis powers
Back to top
View user's profile Send private message
angerist
Grandmaster Cheater Supreme
Reputation: 0

Joined: 18 Jun 2007
Posts: 1011
Location: Australia.

PostPosted: Fri Apr 04, 2008 1:25 am    Post subject: Reply with quote

Ohhh ok. Thanks
_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Fri Apr 04, 2008 1:35 am    Post subject: Reply with quote

1. { } brackets, use them.

2. weird quotes. " "

3. #include <cstdio>
#include <cstdlib> is pointless.

4. std::cin.sync()
std::cin.ignore()

PAUSE has an enormous overhead.
Back to top
View user's profile Send private message
angerist
Grandmaster Cheater Supreme
Reputation: 0

Joined: 18 Jun 2007
Posts: 1011
Location: Australia.

PostPosted: Fri Apr 04, 2008 3:22 am    Post subject: Reply with quote

Oh thanks i've fixed it thanks to you slovach Laughing
_________________
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Fri Apr 04, 2008 3:41 am    Post subject: Reply with quote

Usually happens when you copy stuff from wordpress.
Back to top
View user's profile Send private message MSN Messenger
Deletion
I post too much
Reputation: 0

Joined: 22 Jun 2006
Posts: 2148
Location: Underground

PostPosted: Fri Apr 04, 2008 2:29 pm    Post subject: Reply with quote

Booo, I helped first. D:
_________________
Bitch, please.
redslothx wrote:
oh im a man so respect the penis powers
Back to top
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Mon Apr 07, 2008 4:29 pm    Post subject: Reply with quote

You can do this:
cout << “Fahrenheit value is: ” << fahrenheit << endl;
instead of:
cout << “Fahrenheit value is:”;
cout << fahrenheit << endl;

When using the iostream... They can even look like this:

cout << “F" << "a" << "h" << "r" << "e" << "n" << "h" << "e" << "i" << "t" << " " << "v" << "a" << "l" << "u" << "e" << " " << "i" << "s" << ":" << " ” << fahrenheit << endl;

Thats a bit extream, but it can help with really long segments and other things, works with cin << x << y too.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites