Hi every one

i have project and i need your help !!

this is the project you can look

http://store2.up-00.com/Apr13/Ddd93410.png

http://store2.up-00.com/Apr13/9HA93410.png

Recommended Answers

All 3 Replies

You might want to make a c++ base chass, such as clzss Shape, that contains all the basic data such as parameter, area, etc. Then derive circle, square,etc from shape. In the Shape class you could put methods that are common to all shapes, such as get/set for the data.

Other than some suggestions, no one is going to do all your homework for you. Post the code you have written and ask questions about what you may not understand and others will be more than happy to help you out.

#include <iostream>
#include <cmath>
 using namespace std;


 int main()
 {
     int x;
     float overall,whight,wwidth,fwidth,md,sqrl,recl,recw,redius;

     cout<<"Geometric Shapes Application"<<endl;
       cout<<endl;
     cout<<"[1] circle"<<endl;
      cout<<"[2] square "<<endl;
       cout<<"[3] rectangle"<<endl;
       cout<<"[4] I - section "<<endl;
       cout<<"[5] T - section "<<endl;
       cout<<"[6] creeat new file "<<endl;
       cout<<"[7] Display previous results "<<endl;
     cout<<"[9] Exit"<<endl;
           cout<<endl;

           cout<<" Enter your choice "<<endl;
           cin>>x;
           cout<<endl;


    switch (x){
    case 1 :
        cout<<" circle input "<<endl;
        cout<<" =============="<<endl;
        cout<<endl;
        cout<<" Enter the radius of the circle "<<endl;
        cin>>redius;
            cout<<endl;
            cout<<" circle Properties"<<endl;
                cout<<" ================="<<endl;
                cout<<endl;
                cout<<" circle redius   = "<<redius;
                    cout<<endl;
                    cout<<" Area            = "<<redius*redius*22/7;
                    cout<<endl;
                    cout<<"Section Drawing:"<<endl;
                     cout<<endl;

    double y,x,r;
    r=redius;

    for(y=0.0;y>=(-2.0*r);y=y-0.5){
        for(x=0.0;x<=(2.0*r);x=x+0.5){
            if( ( (x-r)*(x-r) + (y+r)*(y+r) ) <=(r*r) )
                 cout<<"* ";
            else cout<<"  ";}
        cout<<endl;}
    cout<<endl;
       break;
    case 2 :
        cout<<" square input "<<endl;
        cout<<" =============="<<endl;
        cout<<endl;
        cout<<" Enter the lenght of square:"<<endl;
        cin>>sqrl;
            cout<<endl;
            cout<<"Square Properties"<<endl;
                cout<<"================="<<endl;
                cout<<endl;
                cout<<" Square Lenght   = "<<sqrl;
                    cout<<endl;
                    cout<<" Perimeter       = "<<4*sqrl<<endl;
                    cout<<" Area            = "<<2*sqrl<<endl;
                        cout<<endl;
                    cout<<"Section Drawing:"<<endl;
                    cout<<endl;

int line, stars, loop;
for (line = 1; line <= sqrl; line++)
{
                   stars =sqrl ;
    for (loop = 1; loop <= stars; loop++)
        cout << "*";
    cout << endl;
}
                    break;
                    cout<<endl;
    case 3 :
        cout<<" rectangle input "<<endl;
        cout<<" =============="<<endl;
        cout<<endl;
        cout<<" Enter the lenght of rectangle :"<<endl;
        cin>>recl;
        cout<<" Enter the width of rectangle :"<<endl;
        cin>>recw;
            cout<<endl;
            cout<<" Rectangle Properties"<<endl;
                cout<<"================="<<endl;
                cout<<endl;
                        cout<<" Rectangle lenght     ="<<recl<<endl;
                                cout<<" Rectangle width      ="<<recw<<endl;
                    cout<<endl;
                    cout<<" Perimeter            = "<<2*recw+2*recl<<endl;
                    cout<<" Area                 = "<<recl*recw<<endl;
                        cout<<endl;
                    cout<<"Section Drawing:"<<endl;
                    break;
                    cout<<endl;
                    break;
    case 4 :

        cout<<" I - section input "<<endl;
        cout<<" ================="<<endl;
            cout<<endl;
        cout<<"Enter overall depth(mm):"<<endl;
        cin>>overall;
        cout<<"Enter web height (mm):"<<endl;
        cin>>whight;
        cout<<"Enter web width (mm):"<<endl;
        cin>>wwidth;
        cout<<"Enter flange width(mm):"<<endl;
        cin>>fwidth;
        cout<<"Enter material density (kg/m^3):"<<endl;
        cin>>md;
            cout<<endl;
                    cout<<"Section Drawing:"<<endl;
        break;

    case 5 :
    case 6 :
    case 7 :
    case 9 : return 0;

    }

    return 0;}

Thi is the code but i dont know i dont know how to show the users the pervious result, save it and how to draw a rectangle

A square is just a rectangle with all four sides the same length. Are you sure you need separate cases for square and rectangle?

i dont know how to show the users the pervious result,

After getting the value of x save it in another variable. If they want to see previous results just restore x to previous saved value and do the switch statement.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.