Thread: ???

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    6

    ???

    #include<iostream>
    #include<string>
    using namespace std;
    void main()
    {
    string password,answer;
    float x,y;
    float sum,difference,product,quotient;
    char Operation;

    cout<<"enter password:"<<endl;
    cin>>password;

    if (password=="rhino")

    {
    cout<<"enter Letter Operation"<<endl;
    cout<<"a for Addition"<<endl;
    cout<<"s for Subtraction"<<endl;
    cout<<"m for Multiplication"<<endl;
    cout<<"d for Division"<<endl;
    cin>>Operation;

    while(answer!="no")//(answer=="yes");
    {

    switch(Operation)
    {
    case 'a':
    cout<<"enter first number"<<endl;
    cin>>x;
    cout<<"enter second number"<<endl;
    cin>>y;
    sum=x+y;
    cout<<"The sum is:"<<sum<<endl;
    cout<<"do you want to continue?"<<endl;
    cout<<"Yes or No:"<<endl;
    cin>>answer;

    if (answer=="yes"){
    cout<<"enter Letter Operation"<<endl;
    cout<<"a for Addition"<<endl;
    cout<<"s for Subtraction"<<endl;
    cout<<"m for Multiplication"<<endl;
    cout<<"d for Division"<<endl;
    cin>>Operation;}
    break;
    case 's':
    cout<<"enter first number"<<endl;
    cin>>x;
    cout<<"enter second number"<<endl;
    cin>>y;
    difference=x-y;
    cout<<"The difference is:"<<difference<<endl;
    cout<<"do you want to continue?"<<endl;
    cout<<"Yes or No:"<<endl;
    cin>>answer;

    if(answer=="yes"){
    cout<<"enter Letter Operation"<<endl;
    cout<<"a for Addition"<<endl;
    cout<<"s for Subtraction"<<endl;
    cout<<"m for Multiplication"<<endl;
    cout<<"d for Division"<<endl;
    cin>>Operation;}
    break;
    case 'm':
    cout<<"enter first number"<<endl;
    cin>>x;
    cout<<"enter second number"<<endl;
    cin>>y;
    product=x*y;
    cout<<"The product is:"<<product<<endl;
    cout<<"do you want to continue?"<<endl;
    cout<<"Yes or No:"<<endl;
    cin>>answer;

    if(answer=="yes"){
    cout<<"enter Letter Operation"<<endl;
    cout<<"a for Addition"<<endl;
    cout<<"s for Subtraction"<<endl;
    cout<<"m for Multiplication"<<endl;
    cout<<"d for Division"<<endl;
    cin>>Operation;}
    break;
    case 'd':
    cout<<"enter first number"<<endl;
    cin>>x;
    cout<<"enter second number"<<endl;
    cin>>y;
    quotient=x/y;
    cout<<"The quotient is:"<<quotient<<endl;
    cout<<"do you want to continue?"<<endl;
    cout<<"Yes or No:"<<endl;
    cin>>answer;

    if(answer=="yes"){
    cout<<"enter Letter Operation"<<endl;
    cout<<"a for Addition"<<endl;
    cout<<"s for Subtraction"<<endl;
    cout<<"m for Multiplication"<<endl;
    cout<<"d for Division"<<endl;
    cin>>Operation;}
    break;
    default:
    cout<<"Letter Incorrect"<<endl;

    break;
    }


    }
    }else
    cout<<"SoRRy WrOng PaSSwOrd!!!TrY AgaIn...";

    }

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    beats me!

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Given that there are three question marks, there must be three questions. I just wonder what they are. I'm guessing the answers are
    1. You begin your code (here, that is) with [code] and end it with [/code], otherwise it just looks bad.
    2. No, void main has never and will never be valid C++.
    3. Your menu needs to be inside the while loop above the switch statement, not in each individual case statement which is just being silly.

  4. #4
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    I guess the three question marks means "Read the code if you can" or "Guess the question if you can".
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Let's see:

    1) Completely meaningless topic title.
    2) No actual question, just a code dump.
    3) Not even code tags for that dump.

    Yeah, I think I'll close this thread.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed