please solve this

Write your question here.
#include<iostream.h>
int main()
{
int a,b,c,d,e,ch,r;
float result;
cout<<"Jowel's Calculator \n";
cout<<"1. Addition \n";
cout<<"2. Subtraction \n";
cout<<"3. Division \n";
cout<<"4. Multiplication \n";
cout<<"5. Area of a circle \n";
cout<<"6. Area of a triangle \n";
cout<<"7. Average of 5 numbers \n";
cout<<"8. Convert Celsius to Farenheit \n";
cout<<"9. Convert Farenheit to Celsius \n";
cout<<"10. Square root \n";
cout<<"11. Cube root \n";
cout<<"12. Square \n";
cout<<"13. Cube \n";
cout<<"Enter your choice";
cin>>ch;
switch(ch);
{
case 1:
cin>>a>>b;
result=a+b;
cout<<"Sum = "<<result;
break;
case 2:
cin>>a>>b;
result=a-b;
cout<<"Difference = "<<result;
break;
case 3:
cin>>a>>b;
result=a/b;
d=a%b;
cout<<"Quotient = "<<result;
cout<<"Remainder = "<<d;
break;
case 4:
cin>>a>>b;
result=a*b;
cout<<"Product = "<<result;
break;
case 5:
cin>>r;
result=3.14*r*r;
cout<<"Area = "<<result;
break;
case 6:
cin>>a>>b>>c;
s=(a+b+c)/2
result=sqrt(s*(s-a)*(s-b)*(s-c));
cout<<"Area = "<<result;
break;
case 7:
cin>>a>>b>>c>>d>>e;
result=(a+b+c+d+e)/5
cout<<"Average = "<<result;
break;
case 8:
cin>>a;
result=(1.8*a)+32;
cout<<"Temperature = "<<result;
break;
case 9:
cin>>a;
result=a-32/18;
cout<<"Temperature = "<<result;
break;
case 10:
cin>>a;
result=sqrt(a,2);
cout<<"Square root = "<<result;
break;
case 11:
cin>>a;
result=sqrt(a,3);
cout<<"Cube root = "<<result;
break;
case 12:
cin>>a;
result=pow(a,2);
cout<<"Square = "<<result;
break;
case 13:
cin>>a;
result=pow(a,3);
cout<<"Cube = "<<result;
break;
}
}


--------------------Configuration: mingw5 - CUI Debug, Builder Type: MinGW--------------------

Checking file dependency...
Compiling C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp...
[Warning] C:\Borland\C-FREE~1\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\backward\backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:24: error: case label `1' not within a switch statement
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:28: error: break statement not within loop or switch
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:29: error: case label `2' not within a switch statement
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:33: error: break statement not within loop or switch
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:34: error: case label `3' not within a switch statement
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:40: error: break statement not within loop or switch
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:41: error: case label `4' not within a switch statement
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:45: error: break statement not within loop or switch
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:46: error: case label `5' not within a switch statement
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:50: error: break statement not within loop or switch
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:51: error: case label `6' not within a switch statement
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:53: error: `s' was not declared in this scope
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:54: error: expected `;' before "result"
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:56: error: break statement not within loop or switch
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:57: error: case label `7' not within a switch statement
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:60: error: expected `;' before "cout"
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:61: error: break statement not within loop or switch
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:62: error: case label `8' not within a switch statement
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:66: error: break statement not within loop or switch
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:67: error: case label `9' not within a switch statement
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:71: error: break statement not within loop or switch
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:72: error: case label `10' not within a switch statement
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:74: error: `sqrt' was not declared in this scope
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:76: error: break statement not within loop or switch
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:77: error: case label `11' not within a switch statement
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:81: error: break statement not within loop or switch
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:82: error: case label `12' not within a switch statement
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:84: error: `pow' was not declared in this scope
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:86: error: break statement not within loop or switch
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:87: error: case label `13' not within a switch statement
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:91: error: break statement not within loop or switch
[Error] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:92: error: expected `;' before '}' token
[Warning] C:\Users\Jestin\Documents\C-Free\Temp\Untitled2.cpp:93:2: warning: no newline at end of file

Complete Make Untitled2: 32 error(s), 2 warning(s)


Remove the semicolon after the switch(ch); // <- misplaced semicolon
Topic archived. No new replies allowed.