I need help to promote user to enter y/n in switch statement to continue or not

I need help to promote user to enter y/n in switch statement to continue or not for an other conversion after showing results of each conversion.


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
  #include <iostream>
using namespace std;


int main()
          {
    char a;
    double n, r1, r2;
  cout<<"Please Chose the Temperature Unit to Convert: "<<endl<<endl;
    
    cout<<"F for Fahrenheit to Celsius & Kelvin. "<<endl;
    cout<<"C for Celsius to Fahrenheit & Kelvin. "<<endl; 
    cout<<"K for Kelvin to Fahrenheit & Celsius. "<<endl;
    cin>>a;
    
   
    switch (a)
    {        case 'f': 
             case 'F': 
             cout<<"Enter your Valu in Fahrenheit: "<<endl;
             cin>>n;
             
             r1=(n+459.67)*5/9;
             cout<<"Kelvin = "<<r1<<endl;
             
             r2=r1-273.15;             
             cout<<"Celsius = "<<r2<<endl;
                           break;
             
             case 'c': 
             case 'C': 
             cout<<"Enter your Valu in Celsius: "<<endl;
             cin>>n;
             
             r1=n+273.15;
             cout<<"Kelvin = "<<r1<<endl;
             
             r2=n*9/5+32;             
             cout<<"Fahrenheit = "<<r2<<endl;
                           break;
             case 'k': 
             case 'K': 
             cout<<"Enter your Valu in Kelvin: "<<endl;
             cin>>n;
             
             r1=n-273.15;
             cout<<"Celsius = "<<r1<<endl;
             
             r2=r1*9/5+32;             
             cout<<"Fahrenheit = "<<r2<<endl;
                           break;                           
             
                            
    }   
    

    
    
system("pause");           

}
Try to include your code: lines 9 - 54 in a while loop(bolds)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

   ...your code lines 1 - 8...

char q = 'y';

while((q == 'y') || (q == 'Y'))
{


   ...your code lines 9 - 54...


}

   ...your code lines 59 - 61...
Please Chose the Temperature Unit to Convert: 

F for Fahrenheit to Celsius & Kelvin. 
C for Celsius to Fahrenheit & Kelvin. 
K for Kelvin to Fahrenheit & Celsius. 
f
Enter your Valu in Fahrenheit: 
100
Kelvin = 310.928
Celsius = 37.7778
Continue (y / n) ? y
Please Chose the Temperature Unit to Convert: 

F for Fahrenheit to Celsius & Kelvin. 
C for Celsius to Fahrenheit & Kelvin. 
K for Kelvin to Fahrenheit & Celsius. 
C
Enter your Valu in Celsius: 
40
Kelvin = 313.15
Fahrenheit = 104
Continue (y / n) ? n
Topic archived. No new replies allowed.