this program works but i need to put in a loop that the user 10 times to input a value and you load it ino an array
#include<iostream.h>
#include<conio.h>
//Author:
//Object:
//Date:
void ctof(void); //function declarations (prototypes)
void ftoc(void);
float c,f; // (outside the functions)
main()
{
int option;
//--------------output the menu to the screen -----
do{
clrscr();
cout<<" 2012 Convertor"<<endl<<endl;
cout<<" Main Menu"<<endl<<endl;
cout<<"1) f -> c "<<endl;
cout<<"2) c -> f "<<endl<<endl;
cout<<"3) Exit the Program"<<endl<<endl;
cout<<"Please enter your choice: ";
cin>>option;
//-----------------what was the operators choice--
if (option == 1)
ctof(); //call the ctof function
//-------- they want to convert from F -> C ---
if (option == 2)
ftoc(); //call the ftoc function
}while(option !=3); //exit loop if option = 3
getch();
} //end of the program
//------------
void ftoc(void)
{
clrscr();
cout<<"Please enter your 1st Reading:";
cin>>f;
c=(f-32)/9*5; //do calculation
cout<<f<<" degress fahrenheit = "<<c<<" degrees celcius"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 2nd Reading:";
cin>>f;
c=(f-32)/9*5; //do calculation
cout<<f<<" degress fahrenheit = "<<c<<" degrees celcius"<<endl;
cout<<"Please enter your 3rd Reading:";
cin>>f;
c=(f-32)/9*5; //do calculation
cout<<f<<" degress fahrenheit = "<<c<<" degrees celcius"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 4th Reading:";
cin>>f;
c=(f-32)/9*5; //do calculation
cout<<f<<" degress fahrenheit = "<<c<<" degrees celcius"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 5th Reading:";
cin>>f;
c=(f-32)/9*5; //do calculation
cout<<f<<" degress fahrenheit = "<<c<<" degrees celcius"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 6th Reading:";
cin>>f;
c=(f-32)/9*5; //do calculation
cout<<f<<" degress fahrenheit = "<<c<<" degrees celcius"<<endl;;
cout<<endl; //To end the line
cout<<"Please enter your 7th Reading:";
cin>>f;
c=(f-32)/9*5; //do calculation
cout<<f<<" degress fahrenheit = "<<c<<" degrees celcius"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 8th Reading:";
cin>>f;
c=(f-32)/9*5; //do calculation
cout<<f<<" degress fahrenheit = "<<c<<" degrees celcius"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 9th Reading:";
cin>>f;
c=(f-32)/9*5; //do calculation
cout<<f<<" degress fahrenheit = "<<c<<" degrees celcius"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 10th Reading:";
cin>>f;
//readings now all entered into the string
c=(f-32)/9*5; //do calculation
cout<<f<<" degress fahrenheit = "<<c<<" degrees celcius"<<endl;
cout<<"Please press any key to continue..";
getch();
}
//--------------------------------------------------------------------------
void ctof(void)
{
clrscr();
cout<<"Please enter your 1st Reading:";
cin>>c;
f=c/5*9+32; //do calculation
cout<<c<<" degress celcius = "<<f<<" degrees fahrenheit"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 2nd Reading:";
cin>>c;
cout<<endl; //To end the line
cout<<"Please enter your 3rd Reading:";
cin>>c;
f=c/5*9+32; //do calculation
cout<<c<<" degress celcius = "<<f<<" degrees fahrenheit"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 4th Reading:";
cin>>c;
f=c/5*9+32; //do calculation
cout<<c<<" degress celcius = "<<f<<" degrees fahrenheit"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 5th Reading:";
cin>>c;
c=f/5*9+32; //do calculation
cout<<c<<" degress celcius = "<<f<<" degrees fahrenheit"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 6th Reading:";
cin>>c;
f=c/5*9+32; //do calculation
cout<<c<<" degress celcius = "<<f<<" degrees fahrenheit"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 7th Reading:";
cin>>c;
f=c/5*9+32; //do calculation
cout<<c<<" degress celcius = "<<f<<" degrees fahrenheit"<<endl;
cout<<"Please enter your 8th Reading:";
cin>>c;
f=c/5*9+32; //do calculation
cout<<c<<" degress celcius = "<<f<<" degrees fahrenheit"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 9th Reading:";
cin>>c;
f=c/5*9+32; //do calculation
cout<<c<<" degress celcius = "<<f<<" degrees fahrenheit"<<endl;
cout<<endl; //To end the line
cout<<"Please enter your 10th Reading:";
cin>>c;
f=c/5*9+32; //do calculation
cout<<c<<" degress celcius = "<<f<<" degrees fahrenheit"<<endl;
cout<<"Please press any key to continue..";
getch(); // calculation now done data done
}