Jump to content

Recommended Posts

Posted

Is C++ code when your hot teacher tells you that you only have a C , but if you diddle her after school, you might get a C++?

 

*sighs*

 

201127233535_TripleFacepalm.jpg

  • Like 1
Posted

Is C++ code when your hot teacher tells you, with a wink and a gleam in her eye, that you only have a C , but if you diddle her after school, you might get a C++?

Soul, I know that you are going back to school and as a friend and fellow FA member, I highly, highly encourage you to NOT do this. Okay? :)

  • Like 1
Posted

Is C++ code when your hot teacher tells you, with a wink and a gleam in her eye, that you only have a C , but if you diddle her after school, you might get a C++?

This :D hahaha

Posted

Gotta get ahead somehow, darnit!

Posted

Gotta get ahead somehow, darnit!

 

Work your ass off :P Oh wait... that was the problem in the first place. Just work... hard? Damn it, Soul!

Posted

Ok, fine... I'll "work it" very hard.......I got moves like Jagger :)

Posted

Ok, fine... I'll "work it" very hard.......I got moves like Jagger :)

 

Of course you have... ....

...

 

 

Wait... how did we get so horribly off topic?

Posted

See? This is why we can never have anything nice! You guys just thread hijacking all over the place.

Posted

Okay this is the start Heretic- IDK what the errors are, but I'll look at it after dinner.

#include <iostream>

int main()
{
    double num1;
    char op;
    double num2;
    int pick;
    double answer;


    {
        std::cout << "Please enter your first number.\n";
        std::cin >> num1
        std::cout << "Please enter your second number.\n";
        std::cin >> num2

        std::cout << "Do you wish to add << "+" >> these numbers?\n";
        std::cout << "Press y to add numbers or n to leave program.\n";

        std::cin >> pick
    }
        if (pick == y)
        {
            answer = num1 + num2;
            std::cout << num1 << "+" << num2 "=" << answer << std::endl;
        }
        if (pick == n)
        {
            return 0;
        }



Posted

Okay second try after a fresh look. LOL!

#include <iostream>

int main()
{

    double num1;
    char op;
    double num2;
    int pick;
    double answer;


    {
        std::cout << "Please enter your first number.\n";
        std::cin >> num1;
        std::cout << "Please enter your second number.\n";
        std::cin >> num2;

        std::cout << "Please enter the operator you wish to use, choices +.\n";
        std::cin >> op;

        if (op == '+')
        {
            answer = num1 + num2;
            std::cout << num1 << "+" << num2 << "=" << answer << std::endl;
        }
    }
        std::cout << "Press '1' to restart the program or '0' to quit. \n";
        std::cin >> pick;

        if(pick == 1)
        {
            main ();
        }
        if(pick == 0)
        {
            return 0;
        }
}


Posted

Okay here I was going for the loop, but after entering either y or n it closes the program. Hmmph!

#include <iostream>

int main()
{

    float Num1;
    float Num2;
    float Answer;

    int which_calculation;

    char again = 'y';

    {
        std::cout << "Press 1 to add.\n";
        std::cin >> which_calculation;

        std::cout << "Please enter your first number.\n";
        std::cin >> Num1;
        std::cout << "Please enter your second number.\n";
        std::cin >> Num2;
    }
        if (which_calculation == 1)
        {
            Answer = Num1 + Num2;
        }

    std::cout << "The answer is ...\n";
    std::cout << Answer << std::endl;

    if (again == 'y')
    {
        std::cout << "again (y/n)?";
        std::cin >> again;
    }
}




Posted

Little confused about the parenthesis on line 14 & 22 lol

 

Also, you're not getting the user input for "answer" :P

So "answer" is constantly "y"

  • Like 1
Posted

Yes that is the issue that I was getting. It was driving me nuts. Also when I used while, it would ask me the same question or exit, can't remember which. But if I used n it would restart the process. Help me oh great one.

 

Originally I had

if (again == 'y')
    {
        std::cout << "again (y/n)?";
        std::cin >> again;
    }

before the rest of the script and it would just endlessly ask you if you wanted to do it again. 
Therefore I moved.

 

Which lines are you talking about?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.