//C++ napisz progam, ktory po wprowadzeniu danych sprawdzi czy sa poprawne, a nastepnie po wybraniu z klawiatury R policzy pole rownolegloboku a po wybraniu litery T pole trojkata
#include<iostream>
using namespace std;
int main ()
{
int a,h;
float p;
char w;
cout << "Podaj a: ";
cin >> a;
cout << "Podaj h: ";
cin >> h;
if (a>0 && h>0)
{
cout << "R - pole rownolegloboku LUB T - pole trojkata" << endl; ;
cout << "Wybor: ";
cin >> w;
switch (w)
{
case 'R':
p=a*h;
cout << "Pole rownolegloboku to: " << p << endl;
break;
case 'T':
p=0.5*a*h;
cout << "Pole trojkata to: " << p << endl;
break;
default:
cout << "Zla opcja";
break;
}
}
else
{
cout << "Podales bledne dane";
}
return 0;
}