![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Programming A discussion forum for programs and programming used in tech-related businesses. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Aug 2005
Location: Detroit
Posts: 94
OS: xp
|
i need help with c++
i know i have to use a for loop to get this going, but i can't figure it out? any ideas on how to get me going would be great:-) if you could im on aol @aim1crzy.
Write a C++ program that coverts Fahrenheit to Celsius temperature in increments of 5 degrees. The initial value of Fahrenheit temperature and the total conversions to be made are to be requested as user input during program execution. |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) | |
|
TSF Enthusiast
Join Date: Dec 2004
Posts: 604
OS: windows xp
|
Quote:
int temp int count print "enter intial farienhight temperture" input temp print "enter number of 5 degree increaments" input count loop when count>0 print temp print "fairenheight equal in celrious is" print (5/9)*(temp-32) temp = temp +5 count=count-1 end loop I gave it to you in psuodocode so you can learn how to translate a problem into c++ your self.
__________________
Last edited by mgoldb2; 11-20-2005 at 05:13 PM. |
|
|
|
|
|
|
#3 (permalink) |
|
Be Free
|
We Don't Give Out Code Here, If you Give Us What You Already have as your code, we will be able to help you fix a specific problem with your code.
__________________
Suicide Command in Linux : rm -rf / ;) AIM:TheLoneWolf071@aim.com--If You Need Help, Don't Hesitate... |
|
|
|
|
|
#4 (permalink) |
|
Tech Hardware Team
Join Date: Jul 2005
Posts: 1,460
OS: Windows
|
Well done mgoldb2.
aim1crzy, to learn a programming language you have to do the work to learn it properly, that means reading and testing until you understand. We can point you in the right direction, but we do not do the work for anyone. ------------------------------------------- A programming language is no different than anything else, it may look like a big thing but it really is just a bunch of smaller things put together. Questions are like that too, so break it down into smaller parts and solve them. -convert Fahrenheit to Celsius temperature -repeat output in increments of 5 degrees -user input: initial value -user input: total conversions So, basically it's four small tasks that answer this problem. You already understand that some form of looping is needed to satisfy the "repeat output" task, so here are a few tips for the rest... For and While loops have a basic structure that never changes regardless of their content. So make your basic for/while loops and prove they work then you can copy and use them anywhere. A FOR loop is used when you have control over the data it uses. A WHILE loop is used when the data is suspect. Think about it for a moment, what if the user presses a key that's not a number, what do you need to do to ensure the input data are numbers. What messages should you send to the user. Do you have good input data now? What's the main task? What code solves just that task (and does nothing else), test it and verify it works, main task solved.
__________________
Last edited by Stu_computer; 11-24-2005 at 08:46 AM. |
|
|
|
|
|
#5 (permalink) |
|
Registered User
Join Date: Nov 2005
Posts: 4
OS: xp
|
But wait! This *is* C++..sooooooo...
We need a virtual Temperature class that we can derive into Fahrenheit and Celsius classes...probably the constructors could do the conversions. Maybe add a Kelvin class, for absolute reference.... Since we are using a virtual base class, we wouldn't need to overload the convert() function...it would handle the different inherited classes automatically...a neat feature of polymorphism... Last edited by menriquez; 11-22-2005 at 02:12 PM. |
|
|
|
![]() |
| Thread Tools | |
|
|