C++ Calculator Skipping Else Statement
<p>I was making a simple calculator in C++. However the program does not completely function the way it should. When run, the trig if statement executes fine, however, the basic arithmetic else statement doesn't work. I have determined that the code is not executing the else statement and was wondering how to fix it. The code inside the else statement works fine, as I have commented out the if statement. Help?</p>

<p>Here is my code:</p>

<pre><code>#include "stdafx.h"
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;cmath&gt;


int main()
{
    double input = 0;
    double firstnumber = 0;
    double secondnumber = 0;


    std::string function;
    std::string operation;


    std::cout &lt;&lt; "Enter your calculation: ";
    std::cin &gt;&gt; function;   


    if(function == "sin" || "cos" || "tan")
    {
        if(function == "sin")
        {
            std::cin &gt;&gt; input;
            std::cout &lt;&lt; "The sine is " &lt;&lt; sin(input) &lt;&lt; std::endl;
            system("PAUSE");
        }
        else if(function == "cos")
        {
            std::cin &gt;&gt; input;
            std::cout &lt;&lt; "The cosine is " &lt;&lt; cos(input) &lt;&lt; std::endl;
            system("PAUSE");

        }
        else if(function == "tan")
        {
            std::cin &gt;&gt; input;
            std::cout &lt;&lt; "The tangent is " &lt;&lt; tan(input) &lt;&lt; std::endl;
            system("PAUSE");
        }
    }
    else
    {       

        firstnumber = ::atof(function.c_str());
        std::cin &gt;&gt; operation;
        std::cin &gt;&gt; secondnumber;


        double valueadd = firstnumber + secondnumber;
        double valuesubtract = firstnumber - secondnumber;
        double valuemultiply = firstnumber * secondnumber;
        double valuedivide = firstnumber / secondnumber;


        if(operation == "+")
        {      
            std::cout &lt;&lt; " = " &lt;&lt; valueadd &lt;&lt; std::endl;
            system("PAUSE");
        }
        else if(operation == "-")
        {          
            std::cout &lt;&lt; " = " &lt;&lt; valuesubtract &lt;&lt; std::endl;
            system("PAUSE");
        }
        else if(function == "*")
        {
            std::cout &lt;&lt; " = " &lt;&lt; valuemultiply &lt;&lt; std::endl;
            system("PAUSE");
        }
        else if(function == "/")
        {
            std::cout &lt;&lt; " = " &lt;&lt; valuedivide &lt;&lt; std::endl;
            system("PAUSE");
        }

        else
        {
            std::cout &lt;&lt; "Error" &lt;&lt; std::endl;
            return 0;
        }
    }
    return 0;
}
</code></pre>
