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:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* 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
Go Back   Tech Support Forum > The IT Pro > Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Programming A discussion forum for programs and programming used in tech-related businesses.

Reply
 
LinkBack Thread Tools
Old 11-20-2005, 06:17 AM   #1 (permalink)
Registered User
 
aim1crzy's Avatar
 
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.
aim1crzy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
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

Old 11-20-2005, 05:12 PM   #2 (permalink)
TSF Enthusiast
 
Join Date: Dec 2004
Posts: 604
OS: windows xp


Quote:
Originally Posted by aim1crzy
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.
With out giving you the acutrally code I going to give you it in psuodocode.

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.
mgoldb2 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-20-2005, 07:12 PM   #3 (permalink)
Be Free
 
LoneWolf071's Avatar
 
Join Date: Nov 2004
Location: Texas
Posts: 840
OS: Windows XP, Linux


Send a message via AIM to LoneWolf071
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...
LoneWolf071 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-20-2005, 08:34 PM   #4 (permalink)
Tech Hardware Team
 
Stu_computer's Avatar
 
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.
Stu_computer is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-22-2005, 01:45 PM   #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.
menriquez is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 10:17 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85