URGENT Need to pass up my assingment in 1 hour

#include <stdlib.h>
#include <iostream>

using namespace std;

void cmTOinch (){
float a,b;
cout << "Please enter how many cm.\n";
cin >> a;
system("cls");
b= a*.39;
cout <<"\n\n"<< a<<" centemeter(s) would be equal to "<<b<<" inche(s).\n\n";
system("PAUSE");
}

void inchTOcm (){
float a,b;
cout << "Please enter how many inches.\n";
cin >> a;
system("cls");
b= a*2.54;
cout <<"\n\n"<< a<<" inche(s) would be equal to "<<b<<" centemeter(s).\n\n";
system("PAUSE");
}


int main () {

int cmORinch, Restart;
float cm, in;

do {
system("cls");
cout << "What operation do you want to execute? \n Press 1 to convert cm to inch.\n Press 2 to convert inch to cm. \n";
cin >> cmORinch;

system("cls");
if (cmORinch == 1){
cmTOinch ();
}
if (cmORinch == 2){
inchTOcm ();
}
else{
system("cls");
cout << "Please press 1 or 2 "<<cmORinch<<endl;
system("PAUSE");
}

system("cls");
cout << "Press 1 to restart.\nOtherwise press any button to quit.";
cin >> Restart;}
while (Restart==1);



return EXIT_SUCCESS;

}


those are my source code but i need to use these function :

readData - reads the input in inch and return the value to main()
convert - converts the input inch into centimeter and return it to main()
display - prints out the centimeter value

can someone help me please

Fetching data from keyboard:

1
2
3
4
5
6
int fetchDataFromKeyboard()
{
  int x;
  cin >> x;
  return x;
}


Seriously, this is not difficult and a simple search would have found that. Put some effort in. Copying code from http://www.dreamincode.net/forums/topic/35332-cm-to-inch-converter/ and then coming here to ask someone else to do the rest for you is basically doing nothing yourself. The time you wasted asking could have been used to learn.

Last edited on
Topic archived. No new replies allowed.