ok. i have to make a until converter by using only switch cases. i have to let the user choose EXACLTY from what unit to which. I think its stupid but thats the rules. just wanted to see how i was doing. WARINIG!!! its not even close to done yet so...yah
#include<iostream>
#include<string>
#include<stdlib.h>
usingnamespace;
int main(){
system("CLS")
char loop
float in
float ft
float yd
float ml
float cm
float km
float m
float mm
char systemfrom
char systemto
char from
char to
do
{
cout << "Welcome to Measurment System Converter" << endl;
cout <<"Enter What system you want to convert from" << endl;
cout << "Convert from U.S.[u] or Metric[m]: ";
cin >> systemfrom
switch(systemfrom) {
case'u':
cout << "Choose Starting measurement type by typing in it 1 or 2-" << endl;
cout << "lowercase abrevaitions are the flowing" << endl;
cout << "inches=a feet=b yard=c miles=d" << endl;
cout << "Choose here: ";
cin >> from;
switch(from){
case'a':
cout << "You have choosen to convert from inches" << endl;
cout << "What system would you like to convert to? [m/u]: ";
cin >> systemto;
switch(systemto){
case'm':
cout << endl; <<"You have chosen to convert to metric" << endl;
cout << "Which unit would you like to convert to?" << endl;
cout << "millimeters=a centimeters=b meters=c"<< endl;
cout << "kilometers=d Choose here: ";
cin >> to;
switch(to){
case'a':
cout << "You have chosen inches to millimeters" << endl
cout << "Input a inches amout: "
cin >> in;
mm = in * 25.4;
cout << endl; << endl;
cout << "The Answer is " << mm << endl;
break;
case'b':
cout << "You have chosen inches to centimeters" << endl
cout << "Input a inches amout: "
cin >> in;
cm = in * 2.54;
cout << endl; << endl;
cout << "The Answer is " << cm << endl;
break;
case'c':
break;
case'd':
break;
default:
break;
break;
case'u':
break;
default:
break;
break;
case'b':
break;
case'c':
break;
case'd':
default:
defaultcase'm':
default :
/* libraries go here */
#define MM 1.0
#define CM 10.0
#define INCH 254.0
#define FOOT 12*INCH
/* etc. */
#define CHOSE_MM 1
/* etc. */
{
..
printf("what will you convert from?...");
cin >> input;
switch(input){
case CHOSE_MM:
convert_from = MM;
break;
...
}
printf("what will you convert to?...");
...
result = convert_from / convert_to * value;
...
}
hmm that is a thoguht. Why do i really need someone to chose a system. Even though this 'assignment"(really im teaching myself but i follow guidelines of a family member who does no it, but ya. Thanks Grey Wolf. i read other answer u did ur amAAAAAAZING!!!!!!!!!!!