title: First C++ program help (calculator)
body: <p>I am a beginner to C++ and pretty much programming altogether (besides a little <em>html</em> and <em>css</em>). </p>
  
  <p>I have decided to start my first project for C++.</p>
  
  <p>A friend recommended me trying to make a simple calculator so here is my first shot. Any pointers would be great too! Not sure exactly what I am missing, if anything, but the error I am receiving is:</p>
  
  <pre><code>1&gt;------ Build started: Project: CalculatorFinal, Configuration: Debug Win32 ------
  1&gt;  CalculatorFinal.cpp
  1&gt;c:\users\ramee\documents\visual studio 2010\projects\calculatorfinal
   \calculatorfinal\calculatorfinal.cpp(32): warning C4102: 'calc' : unreferenced label
  1&gt;  CalculatorFinal.vcxproj -&gt; c:\users\ramee\documents\visual studio 2010
  \Projects\CalculatorFinal\Debug\CalculatorFinal.exe
  ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>
  
  <p>my code is below (apologize if its not formatted correctly on here. This is my first post :D</p>
  
  <pre><code>  // CalculatorFinal.cpp : Defines the entry point for the console application.
    //
  
    #include "stdafx.h"       // Including header
    #include &lt;iostream&gt;       // Including ioStream
    using namespace std;      // Namespace
  
    void calc (double x, double y);
    double result;
    double n1,n2;             // Declaring Variables
    char q,operation;
  
  
    int main()                
    { 
     cout&lt;&lt;"Welcome to My Calculator" &lt;&lt;endl; // Outputs welcome message
     cout&lt;&lt;""&lt;&lt;endl;                               // Blank Space
     cout&lt;&lt;"INSTRUCTIONS: Input a mathmatical equation" &lt;&lt;endl; // Outputs instruction            
     cout&lt;&lt;"              EX: 2 + 2" &lt;&lt;endl;       // Outputs instruction
     cout&lt;&lt;""&lt;&lt;endl;                               // Blank Space
     cout&lt;&lt;"Operators:"&lt;&lt;endl;                     // Outputs operation header
     cout&lt;&lt;"For Addition, select '+'"&lt;&lt;endl        // Outputs ADD instruction
     cout&lt;&lt;"For Subtraction, select '-'"&lt;&lt;endl;    // Outputs SUB instruction
     cout&lt;&lt;"For Multiplication, select '*'"&lt;&lt;endl; // Outputs MUL instruction
     cout&lt;&lt;"For Division, select '/'"&lt;&lt;endl;       // Outputs DIV instruction
     cout&lt;&lt;""&lt;&lt;endl;                               // Blank Space
     cout&lt;&lt;"To clear, select 'c'"&lt;&lt;endl;  // Outputs clear instruction
     cout&lt;&lt;"To quit, select 'q'"&lt;&lt;endl;   // Outputs QUIT instruction
     cout&lt;&lt;""&lt;&lt;endl;                                                                  // Blank Space
     cout&lt;&lt;"Input a mathmatical equation"&lt;&lt;endl;                                      // Input instructions
     cin&gt;&gt;n1&gt;&gt;operation&gt;&gt;n2;
     calc:(n1,n2);
     cout&lt;&lt;"The answer is:"&lt;&lt;result&lt;&lt;endl;
     std::cin&gt;&gt;q;             // Input "q" to "quit"
     return 0;}
  
  void calc(double x, double y)                                                       // Operator function
      {            x=n1;
      y=n2;
  
      switch(operation)                                                           // Operator swtich statement
      {case '+':
          result = x + y;
          break;
  
      case '-':
          result = x - y;
          break;
  
      case '*':
          result = x * y;
          break;
  
      case '/':
          result = x / y;
          break;
  
      default:
          cout&lt;&lt;"Improper equation. Please input a valid mathmatical equation"&lt;&lt;endl;
          cin&gt;&gt;n1&gt;&gt;operation&gt;&gt;n2;
          calc (n1,n2);
      }
  
   }
  </code></pre>