title: C++ Program Ending after cin assuming value is 0
body: <p>I'm trying to make a program that calculates card balances for a game called Magic the Gathering, but whenever I try to run this program it stops at the first "cin" in main and the debugging says its making numMana 0. I'm new to c++ and I know I could've divided it up into more functions or classes or whatever they're called in c++. Any help you could give me would be much appreciated.</p>
  
  <p>Thanks for any and all of your help,
  Grant</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  float getGreen(void);
  float getBlue(void);
  float getRed(void);
  float getBlack(void);
  float getWhite(void);
  int cardNum(void);
  int numMana;
  float color;
  
  int main(void)
  {
      cout &lt;&lt; "How many mana are there total on the cards" &lt;&lt; endl;
      cout &lt;&lt; "not counting multi-colored" &lt;&lt; endl;
      cin &gt;&gt; numMana;
      cout &lt;&lt; endl;
  
      float green(getGreen());
      float blue(getBlue());
      float red(getRed());
      float black(getBlack());
      float white(getWhite());
      int cardsPre(cardNum());
  
      int numGreen, numBlue, numRed, numBlack, numWhite, mana, totalCards, totalMana;
  
      string name;
  
      mana = (cardsPre / 2);
  
      numGreen = green * mana;
      numBlue = blue * mana;
      numBlack = black * mana;
      numRed = red * mana;
      numWhite = white * mana;
  
      totalMana = numWhite + numRed + numGreen + numBlue + numBlack;
      totalCards = mana + totalMana;
  
      cout &lt;&lt; "What would you like to name your deck?" &lt;&lt; endl;
      cin &gt;&gt; name;
      cout &lt;&lt; endl;
  
      cout &lt;&lt; name &lt;&lt; " has the following percents of each color" &lt;&lt; endl;
      cout &lt;&lt; green &lt;&lt; "% of green" &lt;&lt; endl;
      cout &lt;&lt; blue &lt;&lt; "% of blue" &lt;&lt; endl;
      cout &lt;&lt; red &lt;&lt; "% of red" &lt;&lt; endl;
      cout &lt;&lt; black &lt;&lt; "% of black" &lt;&lt; endl;
      cout &lt;&lt; white &lt;&lt; "% of white" &lt;&lt; endl;
      cout &lt;&lt; "You need" &lt;&lt;numGreen &lt;&lt; " green mana" &lt;&lt;endl;
      cout &lt;&lt; "You need" &lt;&lt;numBlue &lt;&lt; " blue mana" &lt;&lt; endl;
      cout &lt;&lt; "You need" &lt;&lt;numRed &lt;&lt; " red mana" &lt;&lt; endl;
      cout &lt;&lt; "You need" &lt;&lt;numBlack &lt;&lt; " black mana" &lt;&lt; endl;
      cout &lt;&lt; "You need" &lt;&lt;numWhite &lt;&lt; " white mana" &lt;&lt; endl;
      cout &lt;&lt; "You will have" &lt;&lt;totalCards &lt;&lt;" cards in your deck";
      return 0;
  }
  
  float getGreen(void)
  {
      cout &lt;&lt; "How much green mana is there total on your cards?" &lt;&lt; endl;
      cin &gt;&gt; color;
  
      return color / numMana;
  }
  float getBlue(void)
  {
      cout &lt;&lt; "How much Blue mana is there total on your cards?" &lt;&lt; endl;
      cin &gt;&gt; color;
  
      return color / numMana;
  }
  float getRed(void)
  {
      cout &lt;&lt; "How much Red mana is there total on your cards?" &lt;&lt; endl;
      cin &gt;&gt; color;
  
      return color / numMana;
  }
  float getBlack(void)
  {
      cout &lt;&lt; "How much Black mana is there total on your cards?" &lt;&lt; endl;
      cin &gt;&gt; color;
  
      return color / numMana;
  }
  float getWhite(void)
  {
      cout &lt;&lt; "How much White mana is there total on your cards?" &lt;&lt; endl;
      cin &gt;&gt; color;
  
      return color / numMana;
  }
  int cardNum(void)
  {
      int ans;
  
      cout &lt;&lt; "How many cards do you have (Not counting mana)" &lt;&lt; endl;
      cin &gt;&gt; ans;
  
      return ans;
  }
  </code></pre>