Ok, final project!

Pages: 12
Since you guys keep going on about toupper, I got rid of it. Now, the problem is the REPEAT LOOP does not even got executed. Still, please tell me how do i get it to work... where in the main should i place it? how do i get it run?

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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#include <iostream>
#include <cmath>
using namespace std;

void intro();
void introduction();
void get_value(int& value1);
void get_numbers(int& input1, int& input2);
double do_math(int meter);
double conversion(int feet, int inches);
void print_results(int output1, int output2);
void show_results(int results1, int results2);


int main(){

  int m; 
  double final_pounds, final_inches, pounds_convert;
  const int inch = 12;
  int choice = 2;
  char action;

  
  cout<<"Welcome! Enter 1 to proceed to a metric system to English system conversion or enter 2 to proceed to an English system to metric system conversion."<<endl;
  cin>>choice;
  
 do {
  if (choice == 1){
  intro();
  get_value(m);
  pounds_convert = do_math(m);

  final_pounds =(pounds_convert);
  final_inches =(pounds_convert - (floor(final_pounds)))*inch;
  print_results(final_pounds, final_inches);

    }

  else (choice == 2);
{ 

  int f, i;
  double final_meter, final_cm, end_meter;
  const int meter = 100;

  introduction();
  get_numbers(f,i);
  end_meter = conversion(f,i);

  final_meter =(end_meter);
  final_cm =(end_meter - (floor(final_meter)))*meter;
  show_results(final_meter, final_cm);
    }
   
 } while (choice <= 2);

 do{ 
 cout<<"Do you want to repeat this English to metric calculation again? [y/n]"<<endl; 
 cin>>action;
 } while (action == 'y'); 

    return (0);
}

void intro()
{
  using namespace std;
  cout<<"Welcome! This program converts the metric sytems units to English system units."<<endl;
}

void get_value(int& value1 )
{
  using namespace std;
 cout<<"Enter the number of meter in integers: "<<endl;
 cin>>value1;
}

double do_math(int meter)
{ 
  using namespace std;

  double pounds_convert;
  double const foot = 0.3048;

  pounds_convert = meter/foot;

  return pounds_convert;
}

void print_results(int output1, int output2)
{
  using namespace std;

  cout<<"The value in metric systems are "<<output1<< " lb and "<<output2<< " inch "<<endl;

 return;

} 

void introduction()
{
  using namespace std;
  cout<<"Welcome! This program converts the English sytems units to metric system units."<<endl;
}

void get_numbers(int& input1, int& input2)
{
  using namespace std;
 cout<<"Enter the number of feet and inches integers separately: "<<endl;
 cin>>input1;
 cin>>input2;
}

double conversion(int feet, int inches)
{ 
  using namespace std;

  double total_meter, end_meter;
  double const foot = 0.3048, inch = 12;

  total_meter = feet+(inches/inch);
  end_meter = total_meter*foot;

  return end_meter;
}

void show_results(int results1, int results2)
{
  using namespace std;

  cout<<"The value in metric systems are "<<results1<< " m and "<<results2<< "cm"<<endl;

 return;

} 

Well for one thing, take a closer look at line 39. There are at least two problems with it.
Thank you so much for trying to lead me there. I was working on this since last night. I give up. I'm sorry that i just cannot understand ur leads anymore. But thank you. (but can u just tell how to fix my repeat loop?...)
OK...try this: Change:

else (choice == 2);

to:

else if (choice == 2)

and see if you like the results better. (I promise you will.)
Yes, i did. BUT, my repeat loop doesn't work! It doesn't asking me whether i wanna repeat a new calculation or not.

1
2
3
4
5
6
7
8
9
10
Welcome! Enter 1 to proceed to a metric system to English system conversion or enter 2 to proceed to an English system to metric system conversion.
2
Welcome! This program converts the English sytems units to metric system units.
Enter the number of feet and inches integers separately:
4
3
The value in metric systems are 1 m and 29cm

Welcome! This program converts the English sytems units to metric system units.
Enter the number of feet and inches integers separately:


Well, of course not. Your second loop is outside your first loop. How do you expect to get to it as long as the choice variable is valid?

Also, once choice is set, you never set it again.

I know that you're getting frustrated; I've been there. But, I think you're trying to move to quickly on this, and it's causing you to overlook relatively simple mistakes. Try to slow down, and look at this methodically.
U're right. I am frustrated. Well, it's due like in 15 minutes. I guess i'll just submit it now. I'll get back to this to understand it, after cooling down :D. Thank you for all the help :)
Topic archived. No new replies allowed.
Pages: 12