C++ I want to take this in function, what to do?

C++ Coding Tutorial
G

Gabby

New member
Freecoin
93
I want to take this in function, what to do??
#include<iostream>
using namespace std;
#include<iomanip>

int main()
{
int ctr,num,c;
int fahrenheit[10];
cout<<"Enter Value: ";
cin>>num;
cout<<endl;
ctr=0;
do{
cout<<"Enter fahrenheit ";
cin>>fahrenheit[ctr];
ctr++;
}
while(ctr<num);
cout<<setw(15)<<"FAHRENHEIT"<<setw(15)<<"CELSIUS"<<setw(15)<<endl;

for(int x=0;x<num;x++)
{
c=(fahrenheit[x]-32)*5/9;
cout<<setw(15)<<fahrenheit[x]<<setw(15)<<c<<setw(15)<<endl;
}
return 0;
}
 

Richest Freecoded User

Most Freecoin

freecoded
freecoded
2,465 Freecoin
Davy200
Davy200
590 Freecoin
nathan69
nathan69
424 Freecoin
Laureine
Laureine
415 Freecoin
C
codeguru
295 Freecoin
Tekera
Tekera
263 Freecoin
R
ruthailand
221 Freecoin
A
Akubay
170 Freecoin
smitha
smitha
104 Freecoin
G
Gabby
93 Freecoin
Top