Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- // Skilaverkefni1
- //
- // Created by Gunnhildur Omarsdottir on 31/08/14.
- // Copyright (c) 2014 Gunnhildur Omarsdottir. All rights reserved.
- //
- #include <iostream>
- using namespace std;
- double CF (double a);
- double FC (double a);
- double MY (double a);
- double YM (double a);
- double KP (double a);
- double PK (double a);
- int main()
- {
- char A;
- char B;
- double a = 0;
- cin >> A >> B >> a;
- while (A != 'Q' && B != 'Q')
- {
- if (A == 'C')
- {
- cout << CF (a) << endl;
- }
- if else (A == 'F')
- {
- cout << FC (a) << endl;
- }
- if else (A == 'M')
- {
- cout << MY (a) << endl;
- }
- if else (A == 'Y')
- {
- cout << YM (a) << endl;
- }
- if else (A == 'K')
- {
- cout << KP (a) << endl;
- }
- if else (A == 'P')
- {
- cout << PK (a) << endl;
- }
- else
- {
- cout << "Illegal Input" << endl;
- }
- }
- return 0;
- }
- double CF (double a)
- {
- double farenheit = 0;
- farenheit = a * (1.8) + 32;
- return farenheit;
- }
- double FC (double a)
- {
- double celcius = 0;
- celcius = (a - 32) * (0.6);
- return celcius;
- }
- double MY (double a)
- {
- double yards = 0;
- yards = 0.9144 * a;
- return yards;
- }
- double YM (double a)
- {
- double meters = 0;
- meters = 1.09361 * a;
- return meters;
- }
- double KP (double a)
- {
- double pounds = 0;
- pounds = 2.20462 * a;
- return pounds;
- }
- double PK (double a)
- {
- double kilograms = 0;
- kilograms = 2.20462 * a;
- return kilograms;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement