PROSZE O POMOC NA DZISIAJ

PROSZE O POMOC NA DZISIAJ class=

Odpowiedź :

#include <iostream>

using namespace std;

int a,b,h;

int main()

{

cout << "Podaj pierwsza podstawe" <<endl;

cin>>a;

if (a <= 0)

{

    cout << "Podales zle dane" <<endl;

    cout << "Podaj pierwsza podstawe ponownie" << endl;

    cin>>a;

}

 cout << "Podaj druga  podstawe" <<endl;

 cin>>b;

 if (b <= 0)

 {

     cout << "Podales zle dane" <<endl;

     cout << "Podaj druga podstawe ponownie" << endl;

     cin>>b;;

 }

 cout << "Podaj wysokosc " <<endl;

 cin>>h;

 if (h <= 0)

 {

      cout << "Podales zle dane" <<endl;

      cout << "Podaj wysokosc ponownie" << endl;

      cin>>h;

 }

 cout << "Pole tego trapezu wynosi: " << (a + b) * h/2 << endl;

}