0

I have some questions ,i can't solve it .The first one is,

Write a C++ program using the switch statement that does exactly what the following program does:

```
#include <iostream.h>
#include <math.h>
void main ()
{
float number;
int choice;
cout<< "Enter you number";
cin>> number;
cout << "Enter your choice: 1=sin, 2=cos, 3=tan, 4=log ";
cin >> choice;
// nested if's:
if (choice < 1 || choice > 4) {
cout << "wrong choice";
}
else{
if (choice <= 2){
if (choice == 1){
cout << sin(number);
}
else{
cout << cos(number);
}
}
else{
if (choice == 3){
cout << tan(number);
}
else{
cout << log(number);
}
}
}
}
```

Seconed question is:

-Write an interactive program that computes the area of a rectangle (area= base * height) or a triangle (area=0.5 * base * height) after prompting the user to type the first character of the figure name (R or T). Your program must display an error message to indicate that the user entered a character other than R or T.

My program look like this:

```
#include <iostream>
using namespace std;
int main() {
float base,heigh;
char R,T;
cin>>R ,T;
cin>>base , heigh;
if (char== 'R')
cout<<base * heigh<<"R" ;
else if (char=='T')
cout<<0.5*base*heigh<<"T" ;
else
cout<<"you enter neither R nor T";
return 0;
}
```

After i compiled it i have these errors:

four.cpp:8: error: expected primary-expression before "char"

four.cpp:8: error: expected `)' before "char"