how would you write a program which uses a 1D array to store 10 temperature readings
and that the program include 4 functions main(),controller,ctof() and ftoc().
that the program is for converting fahrenheit to celcius
with it being Fahrenheit->Celcius /5*9 +32
Celius -> (Fahrenheit-32)/9*5
1
Expert's answer
2012-03-13T08:06:52-0400
#include <iostream>
using namespace std;
float * ctof(float * deg){ float * res = new float[10]; for( int i=0; i<n; i++ ){ res[i] = deg[i] * 9 / 5 + 32; } return res; }
float * ftoc(float * deg){ float * res = new float[10]; for( int i=0; i<n; i++ ){
res[i] = (deg[i]-32) * 5 / 9; } return res; }
void controller(){ float * temp = new float [n]; cout<<"Input 10 value of tempetarute in Fahrenheit\n"; for( int i=0; i<n; i++ ){ cout<<i+1<<": "; cin>>temp[i]; }
float * cel = ftoc(temp); cout<<"Celcius: "<<endl; for( int i=0; i<n; i++ ){ cout<<i+1<<": "<<cel[i]<<endl;
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment