Switch blocks

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nomana123
    New Member
    • Oct 2008
    • 7

    Switch blocks

    the question is here
    http://www.megaupload. com/?d=RY0AB70J

    Code:
    #include<iostream>
    using namespace std;
    #include <cmath> 
    int main()
    {//variables defined here
    float a,b,E,x,g,h,y,w,q;
    int choice;
    
    cout<<"Which equation would you like to evaluate";
    cout<<"\nPress 1 for this equation, y=10+(5a/3b)-b^2";
    cout<<"\nPress 2 for this equation, w=6x^5-15";
    cout<<"\nPress 3 for this equation, q=(3.0/4.0)h-7g/6";
    cout<<"\nPress 4 for the equation that's not here";
    cin>>choice;
    
    switch (choice)
    {case (1):
    {cout<<"Value for a ";
    cin>>a;
    cout<<"Value for b ";
    cin>>b;
    y=10+((5*a)/(3.0*b))-(pow(b,2));
    cout<<"Value of y is ";
    }
    case (2):
    {cout<<"Value for x ";
    cin>>x;
    w=(6*pow(x,5))-15;
    cout<<"Value for w is";
    }
    case (3):
    {cout<<"Value for g ";
    cin>>g;
    cout<<"Value for h ";
    cin>>h;
    q=((0.75)*h)-((7*g)/6);
    cout<<E;
    }
    case (4):
    {cout<<"Sorry that's all I have for now.";
    }
    cout<<"In order to exit, please press any key. ";
    cin>>E;
  • oler1s
    Recognized Expert Contributor
    • Aug 2007
    • 671

    #2
    Don't put your question on megaupload, or any other site. You can type in a question here directly, and you should do so.

    In general, give us a specific problem. Don't dump your code and run.

    Comment

    Working...