Vous êtes sur la page 1sur 3

#include <iostream>

using namespace std;

double square(int s, int t)

double square_area;

square_area = s * s;

return square_area;

int main()

int side,radius,height,base,length,width,other,x=0,y;

int shape[x];

string shapes[]={"Square","Circle","Triangle","Rectangle"};

double area[x];

do

e:

cout<<"What area would you like to compute?(1.Square, 2.Circle,3.Triangle,4.Rectanngle):


"<<endl;

cin>>shape[x];

if(shape[x]==1)

shapes[0];

cout<<"Enter a side:"<<endl;

cin>>side;

area[x] = square (side,side);

cout<<"another (1.yes/press any key to stop): ";

cin>>other;
}

else if(shape[x]==2)

shapes[1];

cout<<"Enter radius: "<<endl;

cin>>radius;

cout<<"another (1.yes/press any key to stop): ";

cin>>other;

else if(shape[x]==3)

shapes[2];

cout<<"Enter height: "<<endl;

cin>>height;

cout<<"Enter base: "<<endl;

cin>>base;

cout<<"another (1.yes/press any key to stop): ";

cin>>other;

else if(shape[x]==4)

shapes[3];

cout<<"Enter height: "<<endl;

cin>>height;

cout<<"Enter base: "<<endl;

cin>>base;
cout<<"another (1.yes/press any key to stop): ";

cin>>other;

else

cout<<"Sorry 1-4 only"<<endl<<endl;

goto e;

x++;

}while(other==1);

for(y=0;y<x;y++)

cout<<shapes[y]<<" "<<area[y]<<endl;

Vous aimerez peut-être aussi