Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 2nd, 2004, 4:50 AM   #1
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4 TecBrain is on a distinguished road
till i get my compiler, can some one check for any bugs,


a program that will accept a temperature in degrees celsius and output in fahrenheit.

#include <iostream.h>

int main()
{

float a,b;

cin >> a;

//calculation

b = (a*9.0/5.0) + 32;

cout << b;

return 0;

}

Thanks.
__________________
Personal Portfolio
TecBrain Support Forum
Linux VS Windows ... Dont Even Think of it ..
Distribution: Slackware
if (OS==Linux) return success
There are 10 kinds of people, those who can read binary numbers and those who can't.
TecBrain is offline   Reply With Quote
Old Oct 2nd, 2004, 6:05 AM   #2
Ravilj
Programmer
 
Ravilj's Avatar
 
Join Date: Sep 2004
Location: JHB , South Africa
Posts: 79
Rep Power: 4 Ravilj is on a distinguished road
looks fine.

b=(a*1.5) + 32;
__________________
Ravilj's OpenGL Terrain aka WinTerrain Last Updated: 17/01/2005!
Ravilj is offline   Reply With Quote
Old Oct 2nd, 2004, 6:26 AM   #3
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4 TecBrain is on a distinguished road
I am glad to hear that... lol

Ok.. I have installed Dev-C++ and when I run the file and a dos window comes out to input the number... but I got nothing is an output...


How can I get the out put of that?

Thanks for giving your time.
__________________
Personal Portfolio
TecBrain Support Forum
Linux VS Windows ... Dont Even Think of it ..
Distribution: Slackware
if (OS==Linux) return success
There are 10 kinds of people, those who can read binary numbers and those who can't.
TecBrain is offline   Reply With Quote
Old Oct 2nd, 2004, 6:33 AM   #4
Ravilj
Programmer
 
Ravilj's Avatar
 
Join Date: Sep 2004
Location: JHB , South Africa
Posts: 79
Rep Power: 4 Ravilj is on a distinguished road
might wanna add

using namespace std;
under your include, should be able to leave out the .h as well.
__________________
Ravilj's OpenGL Terrain aka WinTerrain Last Updated: 17/01/2005!
Ravilj is offline   Reply With Quote
Old Oct 2nd, 2004, 6:48 AM   #5
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4 TecBrain is on a distinguished road
I am sorry, but i didnt understand what you said. :unsure:
__________________
Personal Portfolio
TecBrain Support Forum
Linux VS Windows ... Dont Even Think of it ..
Distribution: Slackware
if (OS==Linux) return success
There are 10 kinds of people, those who can read binary numbers and those who can't.
TecBrain is offline   Reply With Quote
Old Oct 2nd, 2004, 7:01 AM   #6
Overmind
Professional Programmer
 
Overmind's Avatar
 
Join Date: Jun 2004
Location: South Africa, Johannesburg
Posts: 301
Rep Power: 5 Overmind is on a distinguished road
Quote:
Ok.. I have installed Dev-C++ and when I run the file and a dos window comes out to input the number... but I got nothing is an output...
Did the dos window close by itself after you pressed enter?
__________________
[SIGPIC][/SIGPIC]
Overmind is offline   Reply With Quote
Old Oct 2nd, 2004, 7:14 AM   #7
Ravilj
Programmer
 
Ravilj's Avatar
 
Join Date: Sep 2004
Location: JHB , South Africa
Posts: 79
Rep Power: 4 Ravilj is on a distinguished road
Ignore me... lol... i have been brainwashed into the MS visual studio .net way of thinking...

/me downloads another compiler... :/

It wouldnt have compiled if the namespace was the problem...

Just for future reference when posting code use the [c o d e] // insert code here [/c o d e] tags without the spaces obviouslt. Just makes things easier to read
__________________
Ravilj's OpenGL Terrain aka WinTerrain Last Updated: 17/01/2005!
Ravilj is offline   Reply With Quote
Old Oct 2nd, 2004, 7:17 AM   #8
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
You might want to add another cin at the end of your program otherwise the dos windows might close.
__________________
&quot;Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children.&quot; - Dwight D. Eisenhower
Mjordan2nd is offline   Reply With Quote
Old Oct 2nd, 2004, 7:24 AM   #9
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4 TecBrain is on a distinguished road
Quote:
Originally posted by Overmind@Oct 2 2004, 12:01 PM
Quote:
Ok.. I have installed Dev-C++ and when I run the file and a dos window comes out to input the number... but I got nothing is an output...
Did the dos window close by itself after you pressed enter?
yes
__________________
Personal Portfolio
TecBrain Support Forum
Linux VS Windows ... Dont Even Think of it ..
Distribution: Slackware
if (OS==Linux) return success
There are 10 kinds of people, those who can read binary numbers and those who can't.
TecBrain is offline   Reply With Quote
Old Oct 2nd, 2004, 7:27 AM   #10
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 4 TecBrain is on a distinguished road
Quote:
Originally posted by Mjordan2nd@Oct 2 2004, 12:17 PM
You might want to add another cin at the end of your program otherwise the dos windows might close.
And that cin would be needed to what?
__________________
Personal Portfolio
TecBrain Support Forum
Linux VS Windows ... Dont Even Think of it ..
Distribution: Slackware
if (OS==Linux) return success
There are 10 kinds of people, those who can read binary numbers and those who can't.
TecBrain is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:32 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC