title: C++ Cout & Cin & System "Ambiguous"
body: <p>I was just programming in c++, when all of a sudden all the "cout"s and "cin"s were errors and "Ambiguous". Including System.</p>
  
  <p>I don't know why this happened. Everything was fine, I was coding the same program for about 2 hours, when it just... happened.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I can still run the program without errors, but they show as errors on the text, the red scribbly line. What happened?</p>
  
  <p>I'm using the Visual Studio 2013 IDE, whatever it comes with.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;ctime&gt;
  #include &lt;string&gt;
  #include &lt;Windows.h&gt;
  #include &lt;cstdlib&gt;
  #include &lt;stdlib.h&gt;
  
  using namespace std;
  
  int main()
  {
  
  struct Gun
  {
      string name;
      int damage;
      int cost;
      bool purchased;
      bool equipped;
  
  } M4A1, FAMAS;
  
  //WEAPONS INFO
  M4A1.cost = 50;
  M4A1.damage = 5;
  M4A1.purchased = false;
  M4A1.equipped = false;
  
  FAMAS.cost = 300;
  FAMAS.damage = 10;
  FAMAS.purchased = false;
  FAMAS.equipped = false;
  //WEAPONS INFO
  
  //-----PLAYER(BEGIN)-----
  
  struct Player
  {
      int health;
      string name;
      int money;
      int energy;
  
      string l_a;
      string r_a;
      string l_l;
      string r_l;
  
      string rank;
  
  } Player;
  
  //GAME PLAYER BEGIN
  
  Player.l_a = "Normal";
  Player.r_a = "Normal";
  Player.l_l = "Normal";
  Player.r_l = "Normal";
  
  Player.health = 100;
  Player.money = 100;
  Player.energy = 100;
  
  string plyrname;
  string rank = "Private";
  
  Player.name = plyrname;
  
  //GAME PLAYER END
  
  //-----PLAYER(END)-----
  
  cout &lt;&lt; "What is your name? ";
  cin &gt;&gt; plyrname;
  
  goto mmenu;
  
  
  mmenu:
  
  //-----MAIN MENU(BEGIN)-----
  system("CLS");
  if (Player.l_a == "Damaged")
  {
      cout &lt;&lt; "Your Left Arm is damaged! Sleep for a while to fix it!";
      Sleep(1600);
  }
  if (Player.r_a == "Damaged")
  {
      cout &lt;&lt; "Your Right Arm is damaged! Sleep for a while to fix it!";
      Sleep(1600);
  }
  if (Player.l_l == "Damaged")
  {
      cout &lt;&lt; "Your Left Leg is damaged! Sleep for a while to fix it!";
      Sleep(1600);
  }
  if (Player.r_l == "Damaged")
  {
      cout &lt;&lt; "Your Right Leg is damaged! Sleep for a while to fix it!";
      Sleep(1600);
  }
  
  
  if (Player.money &gt;= 500 &amp;&amp; Player.rank == "Private")
  {
      system("CLS");
      cout &lt;&lt; "You have been promoted to Private 2!";
      Player.rank = "Private 2";
      Sleep(1600);
  
  }
  
  if (Player.money &gt;= 1000 &amp;&amp; Player.rank == "Private 2")
  {
      system("CLS");
      cout &lt;&lt; "You have been promoted to Private First Class!";
      Player.rank = "Private First Class";
      Sleep(1600);
  }
  
  
  system("CLS");
  cout &lt;&lt; "Health: " &lt;&lt; Player.health &lt;&lt; ". Money: " &lt;&lt; Player.money &lt;&lt; " dollars." &lt;&lt; "   Energy: " &lt;&lt; Player.energy;
  if (M4A1.equipped)
      cout &lt;&lt; "\nGun: M4A1";
  if (FAMAS.equipped)
      cout &lt;&lt; "\nGun: FAMAS";
  
  cout &lt;&lt; "\n\nRank: " &lt;&lt; Player.rank;
  cout &lt;&lt; "\n\n1) Go to Gunstore\n2) Sleep\n3) Fight\n\nAction: ";
  int mmenuch1;
  cin &gt;&gt; mmenuch1;
  
  if (mmenuch1 == 1)
  {
      goto gunstore;
  }
  
  if (mmenuch1 == 2)
  {
      system("CLS");
      cout &lt;&lt; "You sleep, restoring your energy.";
      Player.energy = 100;
  
      if (Player.l_a == "Damaged")
      {
          cout &lt;&lt; "\n\nYour Left Arm was healed.";
          Player.l_a = "Normal";
      }
      if (Player.r_a == "Damaged")
      {
          cout &lt;&lt; "\n\nYour Right Arm was healed.";
          Player.r_a = "Normal";
      }
      if (Player.l_l == "Damaged")
      {
          cout &lt;&lt; "\n\nYour Left Leg was healed.";
          Player.l_l = "Normal";
      }
      if (Player.r_l == "Damaged")
      {
          cout &lt;&lt; "Your Right Leg was healed.";
      }
  
  
      Sleep(1400);
      goto mmenu;
  }
  
  if (mmenuch1 == 3)
  {
      system("CLS");
      goto fight;
  }
  
  //-----MAIN MENU(END)-----
  
  
  fight:
  srand(time(0));
  
  system("CLS");
  
  if (Player.r_a == "Damaged" || Player.r_l == "Damaged" || Player.l_a == "Damaged" || Player.l_l == "Damaged")
  {
      cout &lt;&lt; "You're injured, sleep to heal.";
      Sleep(1400);
      goto mmenu;
  }
  
  if (Player.energy &lt; 40)
  {
      cout &lt;&lt; "You don't have enough energy to fight.";
      Sleep(1400);
      goto mmenu;
  }
  
  if (M4A1.equipped == false &amp;&amp; FAMAS.equipped == false)
  {
      cout &lt;&lt; "You don't have a gun equipped.";
      Sleep(1400);
      goto gunstore;
  }
  
  if (M4A1.equipped == true &amp;&amp; Player.energy &gt; 40)
  {
  
      int randnum1 = rand() % (M4A1.damage - 2 + 1) + 2;
      Player.money = Player.money + (randnum1 * 15);
      Player.energy = Player.energy - 40;
  
      int randnum3 = rand() % (10 - 1 + 1) + 1;
      if (randnum3 &lt; 4)
      {
  
          int randnum4 = rand() % (13 - 1 + 1) + 1;
  
          if (randnum4 &lt; 3)
          {
              Player.l_a = "Damaged";
          }
          if (randnum4 &lt;= 6 &amp;&amp; randnum4 &gt;= 4)
          {
              Player.r_a = "Damaged";
          }
          if (randnum4 &lt;= 9 &amp;&amp; randnum4 &gt;= 7)
          {
              Player.l_l = "Damaged";
          }
          if (randnum4 &lt;= 13 &amp;&amp; randnum4 &gt;= 10)
          {
              Player.r_l = "Damaged";
          }
  
  
  
      }
  
  
      cout &lt;&lt; "You fight, killing " &lt;&lt; randnum1 &lt;&lt; " enemies, making " &lt;&lt; randnum1 * 15 &lt;&lt; " dollars!";
      Sleep(1600);
      goto mmenu;
  
  
  
  
  
  }
  
  
  
  
  if (FAMAS.equipped == true &amp;&amp; Player.energy &gt; 40)
  {
      int randnum2 = rand() % (FAMAS.damage - 4 + 1) + 4;
      Player.money = Player.money + (randnum2 * 15);
      Player.energy = Player.energy - 40;
  
  
  
  
      int randnum5 = rand() % (10 - 1 + 1) + 1;
      if (randnum5 &lt; 4)
      {
  
          int randnum6 = rand() % (13 - 1 + 1) + 1;
  
          if (randnum6 &lt; 3)
          {
              Player.l_a = "Damaged";
          }
          if (randnum6 &lt;= 6 &amp;&amp; randnum6 &gt;= 4)
          {
              Player.r_a = "Damaged";
          }
          if (randnum6 &lt;= 9 &amp;&amp; randnum6 &gt;= 7)
          {
              Player.l_l = "Damaged";
          }
          if (randnum6 &lt;= 13 &amp;&amp; randnum6 &gt;= 10)
          {
              Player.r_l = "Damaged";
          }
  
  
  
      }
  
  
  
      cout &lt;&lt; "You fight, killing " &lt;&lt; randnum2 &lt;&lt; " enemies, making " &lt;&lt; randnum2 * 15 &lt;&lt; " dollars!";
      Sleep(1600);
      goto mmenu;
  }
  
  
  
  //-----GUNSTORE(BEGIN)-----
  gunstore:
  system("CLS");
  cout &lt;&lt; "Welcome to the gunstore! You have " &lt;&lt; Player.money &lt;&lt; " dollars.";
  cout &lt;&lt; "\n\n1)M4A1 | Assault Rifle | $50\n2)FAMAS | Assault Rifle | $300\n\n3)Back\n\nAction: ";
  
  int gschoice1;
  
  cin &gt;&gt; gschoice1;
  
  if (gschoice1 == 1)
  {
      goto prchs_M4A1;
  }
  else if (gschoice1 == 2)
  {
      goto prchs_FAMAS;
  }
  else if (gschoice1 == 3)
  {
      goto mmenu;
  }
  
  
  prchs_M4A1:
  
  system("CLS");
  
  if (M4A1.purchased == true)
  {
      cout &lt;&lt; "You already purchased the M4A1. Would you like to equip it?\n\n1)Yes\n2)No\n\nAction: ";
      int gschoice6;
      cin &gt;&gt; gschoice6;
  
      if (gschoice6 == 1)
      {
          system("CLS");
          M4A1.equipped = true;
          FAMAS.equipped = false;
          goto mmenu;
      }
      else if (gschoice6 == 2)
      {
          goto gunstore;
      }
  
  
  }
  
  
  if (Player.money &gt;= 0)
  {
      system("CLS");
      cout &lt;&lt; "Would you like to buy the M4A1?";
      cout &lt;&lt; "\n\n1)Yes\n2)No\n\nAction: ";
  
      int gschoice2;
      cin &gt;&gt; gschoice2;
  
      if (gschoice2 == 1)
      {
          system("CLS");
          Player.money = Player.money - M4A1.cost;
          M4A1.purchased = true;
          cout &lt;&lt; "You've purchased the M4A1. Would you like to equip it?\n\n1)Yes\n2)No\n\nAction: ";
          int gschoice3;
          cin &gt;&gt; gschoice3;
  
  
  
          if (gschoice3 == 1)
          {
              system("CLS");
              M4A1.equipped = true;
              FAMAS.equipped = false;
  
              cout &lt;&lt; "You've equipped the M4A1";
              Sleep(1400);
              goto gunstore;
          }
  
          if (gschoice3 == 2)
          {
              system("CLS");
              M4A1.equipped = false;
              goto gunstore;
          }
  
  
      }
  
      if (gschoice2 == 2)
      {
          system("CLS");
          goto gunstore;
      }
  
  }
  else if (Player.money &lt; 0)
  {
      system("CLS");
      cout &lt;&lt; "You don't have enough money.";
      Sleep(1400);
      goto gunstore;
  }
  
  prchs_FAMAS:
  
  if (FAMAS.purchased == true)
  {
      cout &lt;&lt; "You already purchased the FAMAS. Would you like to equip it?\n\n1)Yes\n2)No\n\nAction: ";
      int gschoice7;
      cin &gt;&gt; gschoice7;
  
      if (gschoice7 == 1)
      {
          system("CLS");
          FAMAS.equipped = true;
          M4A1.equipped = false;
          goto mmenu;
      }
      else if (gschoice7 == 2)
      {
          goto gunstore;
      }
  }
  
  
  
      if (Player.money &gt;= 100)
      {
          system("CLS");
          cout &lt;&lt; "Would you like to buy the FAMAS?";
          cout &lt;&lt; "\n\n1)Yes\n2)No\n\nAction: ";
  
          int gschoice4;
          cin &gt;&gt; gschoice4;
  
          if (gschoice4 == 1)
          {
              system("CLS");
              Player.money = Player.money - FAMAS.cost;
              FAMAS.purchased = true;
              cout &lt;&lt; "You've purchased the FAMAS. Would you like to equip it?\n\n1)Yes\n2)No\n\nAction: ";
              int gschoice5;
              cin &gt;&gt; gschoice5;
  
              if (gschoice5 == 1)
              {
                  system("CLS");
                  FAMAS.equipped = true;
                  M4A1.equipped = false;
                  cout &lt;&lt; "You've equipped the FAMAS";
                  Sleep(1400);
                  goto gunstore;
              }
  
              if (gschoice5 == 2)
              {
                  system("CLS");
                  FAMAS.equipped = false;
                  goto gunstore;
              }
  
  
          }
  
          if (gschoice4 == 2)
          {
              system("CLS");
              goto gunstore;
          }
  
      }
      else if (Player.money &lt; 100)
      {
          system("CLS");
          cout &lt;&lt; "You don't have enough money.";
          Sleep(1400);
          goto gunstore;
      }
      //-----GUNSTORE-----
  
  
  
  
  }
  </code></pre>