All pastes #288064 Raw Edit

Unnamed

public text v1 · immutable
#288064 ·published 2006-12-22 00:25 UTC
rendered paste body
#include <iostream.h> 
int main() {
    int menu, choice;
    int metresSecond, kilometresHour, tempF, tempC;
	unsigned long int usd, gbp, euro, oneGbpToEuro, oneGbpToUsd;
	
    cout << "For conversions involving speed press 1" << endl;
    cout << "For conversions involving temperature press 2" << endl;
	cout << "For conversions involving money press 3" << endl;
    cin >> menu;
    switch(menu) {
    case 1:
         
         cout << "For ms^-1 to kmh^-1 press 1" << endl;
         cout << "For kmh^-1 to ms^-1 press 2" << endl;
         cin >> choice;   
         switch(choice) {
                            case 1:
							{ 
							cout << "Please enter your value in ms^-1" << endl;
                            cin >> metresSecond;
							}
                            kilometresHour = ((metresSecond * 3600)/1000); 
                            cout << "Your speed is: ";
                            cout << kilometresHour;
                            cout << "km/h\n";
                            break;

                            case 2:
							{
                            cout << "Please enter your value in kmh^-1" << endl;
                            cin >> kilometresHour;
                            }
							metresSecond = ((kilometresHour * 1000)/3600);
                            cout << "Your speed is: ";
                            cout << metresSecond;
                            cout << "m/s\n";
                            break;

                            default:
                            cout<<"This isn't a valid option.";
                            return(-1);
                            break;
                            }
		 break;
         
    case 2:
         cout << "For Celcius to Fahrenheit press 1" << endl;
         cout << "For Fahrenheit to Celcius press 2" << endl;
         cin >> choice;
		 switch (choice) {
							case 1:
							cout << "Please enter your value in Celcius" << endl;
							cin >> tempC;
							tempF = ((tempC * 9) /5) + 32;
							cout << "Your value is: ";
							cout << tempF;
							cout << " Degrees Farenheit";
							break;
							case 2:
							cout << "Please enter your value in Fahrenheit" << endl;
							cin >> tempF;
							tempC = ((tempF - 32) * 5) / 9;
							cout << "Your value is; ";
							cout << tempC;
							cout << "Degrees Celcius";
							break;
		 }
	case 3:
		cout << "For GBP to USD press 1" << endl;
		cout << "For USD to GBP press 2" << endl;
		cout << "For GBP to Euro press 3" << endl;
		cout << "for Euro to GBP press 4" << endl;
		cin >> choice;
		switch (choice) {
							case 1:
							cout << "Please enter the conversion rate for 1 GBP to USD (eg 1.92)" << endl;
							cin >> oneGbpToUsd;
							cout << "Please enter your value in GBP\n";
							cin >> gbp;
							usd = (gbp * oneGbpToUsd);
							cout << "Your answer is " << usd; 
							cout << "Dollars" << endl;
							break;
							case 2:
							cout << "Please enter the conversion rate for 1 GBP to USD (eg 1.92)" << endl;
							cin >> oneGbpToUsd;
							cout << "Please enter your value in USD" << endl;
							cin >> usd;
							gbp = (usd / oneGbpToUsd);
							cout << "Your answer is " << usd;
							cout << "Pounds" << endl;
							break;
							}
		break;
    }
   	cin >> metresSecond;
    return 0;
}