Sunday, August 2, 2009

Can anybody help me with c++ version six programming?

Use functions :


1. Write C++ program to convert Celsius degrees to Fahrenheit. The program should request the starting Celsius value, the number of conversions to be made, and the increment between Celsius values. The display should have appropriate headings and list the Celsius value and the corresponding Fahrenheit value. Use the relationship:





Fahrenheit=(9.0/5.0)*Celsius+32.0





2. Write a C++ program that returns the fractional part of any user entered number. For example, if the number 256.879 is entered, the number 0.879 should be displayed. (Hint: Use an int cast). Enter, compile, and execute the program.





please help me thanks!

Can anybody help me with c++ version six programming?
for number 2:





#include %26lt;iostream%26gt;





int Int;


float Float, Fraction;


int main() {


std::cout %26lt;%26lt; "Enter a number with a fractional part: " %26lt;%26lt; std::endl;


std::cin %26gt;%26gt; Float;


Int = (int)Float;


Fraction = Float - Int;


std::cout %26lt;%26lt; std::endl %26lt;%26lt; Fraction;


return 0;


}
Reply:double Fahrenheit,Celsius;


scanf("%1f",%26amp;Celsius);


Fahrenheit=(9.0/5.0)*Celsius+32.0


printf("%1f",Fahrenheit);

clear weed

No comments:

Post a Comment