i need help just a little beginner :)

hello everybody i just started one day ago my course in C++
can any body help me with this code
it keeps tell me that there is error but icant find it

#include <iostream>
using namespace std;
int main ()
{int c;
cout << " enter the Temp in Celisus " << endl;
cin >> c ;
Ye= (1.8*c);
Fr= (Ye + 32);
cout << " the Temp in Ferhenheit = " << Fr << endl;
cout <<"this Pro was desinged by Tariq Co" << endl;
cout <<"PPU University" << endl;
system ("pause");

return 0;
}
you have not decalred the "YE" aNd "FR".

put: int Ye,Fr;
int something; is like an empty box i have just created, now i can use something as much as i like
something = 4;
cout << something

cout <<something+somthing+1;

int something; is like an empty box i have just created


It's not empty. There is a value in there already. You just don't know what it is until you check.
Last edited on
unwanted junk!?
Yup.
closed account (3qX21hU5)
Also int would not be the proper choice for Fr and Ye since he is doing 1.8 * c. So it should be a double Fr; and double Ye; variable instead
closed account (ShpjE3v7)
Hi Tariqsal,

- "system ("PAUSE");" needs "windows.h";
Next time organize your code, please.
... you can optimize this, like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <windows.h>

using namespace std;

int c;
int main()
{
	cout << "Enter the Temp in Celisus: ";
	cin >> c;
	cout << "The Temp in Ferhenheit is " << 1.8 * c + 32 << endl
		 << "This Pro was desinged by Tariq Co" << endl
		 << "PPU University" << endl;
	system ("PAUSE");
	return 0;
}


BTW.: "system ("PAUSE");" isn't the best solution.
Last edited on
Hello Bartek,
I read your reply and am curious about 2 things:
1) Why/how does " system ("PAUSE"); " need <windows.h>? I've always used system pause without it and it worked fine (to my knowledge, that is)
2) Do you mean that system pause is not a good solution because it might/will not work on linux etc. , or for some other reason?

I hope I don't come out as rude or annoying, I'm a beginner and just want to learn. Thank you in advance!
closed account (ShpjE3v7)
- When I try to run a program with 'system();' without 'windows.h' or 'cstdlib' (of which system is a part of) it can't work... but I could be wrong.

- When you utilise 'system();' your program can be marked as a virus.
Last edited on
Op! I was just getting back to erase or edit the comment because I have just found an explanation on another thread. Anthough, thank you!

Funny, I'm on the first year of Computer Science and none of the professors ever mentioned this. Kind of feels like they should though, 'cause it already got into my 'routine' to use it..
closed account (3qX21hU5)
You will learn a lot of professors teach bad habits. But hey it might give you some extra credit if you go to your professor and say "hey I shouldn't be using system() anything because of this this and this ;p
You, and probably the rest of your classmates and professors are likely using Microsoft Visual Studio to write your code it. It automatically includes certain functions, system being the most common, so that you don't have to add an extra header file. This is yet another reason that I hate MSVC++.

The reason he said that system isn't good to use is because of known vulnerabilities with it. Please refer to this for further details: http://cplusplus.com/articles/j3wTURfi/ (there is also possible alternatives to using the system function located here).

Typically it's better to use something similar to the cin.ignore() trick, or something that won't put your system into any danger. If you really want to know proper ways to "pause" your code, have a look at the second stickied thread on this forum. There are also numerous threads floating around about how to "pause" your code. Just do some research.
@Zereo Unfortunately, I haven't yet, but do plan on pointing it out tomorrow. Not so much for the hope of getting extra credit, but to see what he(the prof) has to say.

@Volatile Pulse We are using Dev C++ . And thank you very much for the link, I'm off to read it right away! Of course, I wouldn't be here if I didn't want to learn :)

Thank you all for replying!
Wait, you are using Dev C++ for school? Did they recommend that as your compiler? If so, I'd really look into another school since that compiler is outdated and has a lot of errors in it. MSVC or Code::Blocks are 2 IDEs I use that work pretty well, though like VP I'm not that hot on MSVC.
closed account (3qX21hU5)
I agree with Raezzor Dev++ is outdated and probably shouldn't be used (There are some up to date ones but the original has not been updated in like what 5 years?).

As for Microsoft Visual Studio's it not bad if you are using the full version which comes with a lot of extra features, but for learning purposes and for free versions I would definitely go with Code::Blocks.
Dev++ was last updated in November 2012 which is fairly recent.
http://orwelldevcpp.blogspot.co.uk/

However, there is also an obsolete version which should be avoided.
Oops, ya, I shoulda mentioned Orwell.
Zereo wrote:
(There are some up to date ones but the original has not been updated in like what 5 years?).

Try at least 8, last update that I'm aware of is 2005, but I think there might have been on in 2006 at some point.

Zereo wrote:
As for Microsoft Visual Studio's it not bad if you are using the full version which comes with a lot of extra features, but for learning purposes and for free versions I would definitely go with Code::Blocks.

The fully featured one I hate even more than the express one. The express versions knock MSVC++ down a few notches from being more than it should be. MS tried too hard to make everyone happy that they ended up making even more people hate it. Yeah, there is some awesome features in MSVC++, but none I can't live without, or none that aren't included in some faster, light weight IDE that's equally free, has a community, and the devs of the IDE actually respond to your personal issues/questions/concerns.

Also note, the express versions of 2010 and 2012 are completely free, I think one of them comes with a trial license of the full version.

@Chervil
The Dev-C++ IDE overall has a nice feel, and I completely understand why it's so popular (Bloodshed is still one of the top results when Google'ing C++ IDE, if not the first). I started with an older version of Borland (5.x I think) but when me and the rest of my classmates found out how much it cost, we instantly switched to Bloodshed. It wasn't until recently that I learned about the lack of updates. I even went right to Orwell's, but nothing felt different. Granted it was maintained, but if I'm not mistaken, it's just him. If you insist on using a Dev-C++ IDE, I'd say at the very least, use wxDev-C++. It has a large section of support and some professionals use it. I don't know of any professional environment that uses Orwells, or even Bloodshed.

@Raezzor
I hope you are using C::B. My only problem with it has been I still can't figure out how to use gdb with it. I mean I can debug, but I get so damned confused I give up and cout everything I want.

I find it funny how I just instantly brought up my dislikes about MSVC++ and we're talking about outdated compilers. Meh, it's the small things in life that amuse me I guess.
Last edited on
Just to clarify, I don't actually use either the Bloodshed or Orwell IDE myself.
There's a somewhat repetitive discussion on these forums, (of which I'm also guilty). There is an article on this site which covers the matter - for a while it didn't mention the Orwell version at all, though it does now.

See link for more information http://www.cplusplus.com/articles/36vU7k9E/
Topic archived. No new replies allowed.