Function with switch

For my lab I have to create a menu asking if the user wants Celsius to Fahrenheit, vice versa, and quit program.
This is the code I have so far but I'm not sure where to go from here.
I'm quite lost when it comes to this lab so can someone please guide me.
Thanks!

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
 Chapter 6, Programming Challenge 2
 #include <iostream>
 using namespace std;


 double getCelsius();
 double returnCelsius (double);
 double getFahrenheit();
 double returnFahrenheit(double);
 void displayData(double,double);
 void displayData2(double,double);
 void menu();

 int main()
 {
 double celsius, // Temperature in Celsius
 fahrenheit; //

 char choice

 // Get the temperature in celsius
 celsius = getCelsius();

 //
 fahrenheit = getFahrenheit(celsius);

 //
 displayData(celsius,fahrenheit);



 return 0;
 }

 double returnCelsius(double fahrenheit)
 {
 double celsius;
 celsius = (fahrenheit - 32) * 5/9;
 return celsius;

 }

 double getCelsius()
 {
 double celsius;
 cout << "Please enter a temperature in Celsius: ";
 cin >> celsius;
 return celsius;
 }
 double getFahrenheit()
 {
 double fahrenheit;
 cout << "Please enter a temperature in Fahrenheit: ";
 cin >> celsius;
 return fahrenheit:

 }

 double returnFahrenheit(double celsius)
 {
 double fahrenheit;
 fahrenheit = celsius * 9/5 + 32;
 return fahrenheit;

 }
 void displayData(double celsius,double fahrenheit)
 {
 cout << "The temperature of " <<celsius<< " in Celsius is" <<fahrenheit<< " in fahrenheit.";
 cout << "**********************************************************";
 }
 void displayData(double fahrenheit, double celsius)
 {

 }

 void menu()
 {
 cout<<"Press 1 for Celsius to Fahrenheit.";
 cout<<"Press 2 for Fahrenheit to Celsius.";
 cout<<"Press 3 to quit program.";
 cin>>choice;

 switch (choice)
 {
 case '1':
 getCelsius();
 break;
 case '2':
 getFahrenhei();
 break;
 case '3':
 default:
 return;
 }
 }
 //***************************************************
 // You must write the , *
 // and displayData functions. *
 //***************************[ 
code][/code]
Last edited on
Please, use code tags (the <> formatting button) when posting code.It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/

Hint: You can edit your post, highlight your code and press the <>
formatting button.
Topic archived. No new replies allowed.