My First Program

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
#include <iostream>
using namespace std;
void main()

	int key = 1;
	

	do {
		int from;
		int to;
		double value;
		cout << "Temperature converter" << endl << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl << "The Program is case-sensitve" << endl << "Choose The Temperature You Want To Convert From 1.Celsius, 2 Fahrenheit, 3 kelvin" << endl;
		cin >> from;
		cout << "Choose the Temperature You Want To Convert To 1.Celsius,2 Fahrenheit,3 Kelvin" << endl;
		cin >> to;
		cout << "Choose The Value To Convert" << endl;
		cin >> value;
		/*from kelvin to other units rule*/		
		switch (from) {
		case 1:
			value = value + 273.15;break;
		case 2:
			value = (value + 459.67) * 5 / 9;break;
		case 3:
			break;
		default: break;

		}
		/*from other units to kelvin rule*/
		switch (to)
		{
		case 1:
			value = value - 273.15;break;
		case 2:
			value = value * 9 / 5 - 459.67;break;
		case 3:break;
		default:break;
		}
		cout << "converted value is :" << value << endl;
		cout << "Created by Ahmed Khalid" << endl;

	} while (key);
	cout << "\tPress 1 to continue press 0 to close\n" << endl;

	cin >> key;

}
Last edited on
I ate an apple once. Fun times.
I once saw a snow, probably because it was snowing.
@Ahmed Khalid if you'd rather not get posts like the above ^, you should state your purpose for posting this post. If its a question mark it as such.
Topic archived. No new replies allowed.