Almost done, Please help me finish!!!

I feel like I almost have this one, Please help me fix whatever is wrong with this!!

My output:
Do you want to convert another set of values?(Y/N): y
Enter feet: 4
Enter inches: 5
Result of conversion: 1 meter(s) and 34.62 centimeters
Press any key to continue . . .

Output should look like this:
Enter feet: 4
Enter inches: 5
Result of conversion: 1 meter(s) and 35 centimeters.
Do you want to convert another set of values (Y/N)? Y
Enter feet: 6
Enter inches: 7
Result of conversion: 2 meter(s) and 1 centimeters.
Do you want to convert another set of values (Y/N)? N
Good Bye!







here are my codes:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# include <iostream>  

using namespace std;  

   

void input(double &feet, double &inches);  

void conversion (double feet, double &inches, int &meters, double &centimeters);//prototype  

void output(int meters, double centimeters);   //prototype  

   

void main () //Input Function  

{  

int meters;  

double feet, inches, centimeters;  

char menu;  

   
do 

{  
cout << " Do you want to convert another set of values?(Y/N): ";  

cin >> menu;  

input(feet, inches);  

conversion(feet, inches, meters, centimeters);  

output (meters, centimeters);  


if (menu == 'N' || menu == 'n');  

{ cout << "End of Program " << endl;  

break;    

}  



}while (menu == 'Y' || menu == 'y');  

}  



  

void input(double &feet, double &inches)  

{  

cout << "Enter feet: ";  

cin >> feet;  

cout << "Enter inches: ";  

cin >> inches;  

}  

  

void conversion (double feet, double &inches, int &meters, double &centimeters)  

{  

inches += 12 * feet;  

centimeters = inches * 2.54;  

meters = centimeters/100;  

centimeters -= meters*100;  

}  

   

void output (int meters, double centimeters)  

{  

cout << "Result of conversion: " << meters << " meter(s) and " << centimeters << " centimeters " << endl;  

system ("Pause");
}  
Last edited on
Please put your code into <> format tag. You may get some helpful advices from others.
You may round down or up the value then store it into an int. Use round(). Or get some fast inline functions which can do this.
Topic archived. No new replies allowed.