title: pow() returning 0 (C++)
body: <p>Could someone explain why <code>pow()</code> in the following code is returning a <code>0</code> when the program is run, rather than the actual calculation? I'm a newbie to programming and I'm entirely stumped.</p>
  
  <p>Thanks for any help.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;math.h&gt;
  #include &lt;windows.h&gt;
  using namespace std;
  //Prototypes:
  
  double phiExpo;
  
  double phiNegExpo;    
  
  double opt1f(double phi, double userInput){
        return userInput * phi;}    
  
  double opt2f(double phi, double userInput){
        return userInput / phi;}  
  
  double opt3f(){
        return phiExpo;}   
  
  double opt4f(){
        return phiNegExpo;}   
  
  double phiExpof(double phi, double userInput){
        pow(phi, userInput);}
  
  double phiNegExpof(double phi, double userInput){
        pow(phi,-userInput);}
  
  //Execute program:
  
  int main()
  {
      double userInput;
      int userChoice;
      double phi = 1.61803399;
      bool quit = false; 
      int userChoice2;
      cout &lt;&lt; "I want to (press corresponding number, then enter):" &lt;&lt; endl;
      cout &lt;&lt; endl;
      startchoices: 
      cout &lt;&lt; "1. Multiply by phi:" &lt;&lt; endl;
      cout &lt;&lt; "2. Divide by phi:" &lt;&lt; endl;
      cout &lt;&lt; "3. Exponentiate phi:" &lt;&lt; endl;
      cout &lt;&lt; "4. Negatively exponentiate phi:" &lt;&lt; endl;
      cout &lt;&lt; "5. Quit." &lt;&lt; endl;    
      cout &lt;&lt; endl;
      cin &gt;&gt; userChoice;
      cout &lt;&lt; endl;  
      do {    
         switch (userChoice){
  
                case 1:
                cout &lt;&lt; "Enter number for multiplication: ";
                cin &gt;&gt; userInput;
                cout &lt;&lt; endl;
                cout &lt;&lt; "Phi multiplied by " &lt;&lt; userInput &lt;&lt; ": ";   
                cout &lt;&lt; opt1f(phi, userInput) &lt;&lt; endl;
                cout &lt;&lt; endl;
                Sleep(2000);
                cout &lt;&lt; "1. Continue." &lt;&lt; endl;
                cout &lt;&lt; "2. Return to menu." &lt;&lt; endl;
                cout &lt;&lt; endl;
                cin &gt;&gt; userChoice2;
                cout &lt;&lt; endl;
                if(userChoice2 &gt; 1){
                    goto startchoices;}            
                break;
  
                case 2:
                cout &lt;&lt; "Enter number for division: ";
                cin &gt;&gt; userInput;
                cout &lt;&lt; endl;
                cout &lt;&lt; "Phi divided by " &lt;&lt; userInput &lt;&lt; ": ";
                cout &lt;&lt; opt2f(phi, userInput); 
                cout &lt;&lt; endl;
                Sleep(2000);
                cout &lt;&lt; "1. Continue." &lt;&lt; endl;
                cout &lt;&lt; "2. Return to menu." &lt;&lt; endl;
                cout &lt;&lt; endl;
                cin &gt;&gt; userChoice2;
                cout &lt;&lt; endl;
                if(userChoice2 &gt; 1){goto startchoices;}               
                break; 
  
                case 3:
                cout &lt;&lt; "Enter number to exponentiate phi by: ";
                cin &gt;&gt; userInput;
                cout &lt;&lt; endl;
                cout &lt;&lt; "Phi to the power of " &lt;&lt; userInput &lt;&lt; ": ";
                cout &lt;&lt; opt3f();
                cout &lt;&lt; endl;
                Sleep(2000);
                cout&lt;&lt;endl;
                cout &lt;&lt; "1. Continue." &lt;&lt; endl;
                cout &lt;&lt; "2. Return to menu." &lt;&lt; endl;
                cout &lt;&lt; endl;
                cin &gt;&gt; userChoice2;
                cout &lt;&lt; endl;
                if(userChoice2 &gt; 1){goto startchoices;}               
                break; 
          }
      }
  }
  </code></pre>