Thread: Integer displaying crazy numbers issue

  1. #16
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Code:
    #include <iostream>
    #include <string>
    
    using namespace std;
    int main()
    {
     int gold, loseorgain;
     gold = 1000;
     start:
     cout<<"Enter 1 to gain gold, or 2 to lose gold.";
     cin>> loseorgain;
     cin.ignore();
     if (loseorgain==1)
      gold+= 10;
     else if (loseorgain==2)
      gold-= 10;
     return 0;
    }
    This code compiles with no errors and has only minor grammar-type changes from your original.

  2. #17
    Registered User
    Join Date
    Dec 2004
    Posts
    48
    I figured it out...it was mainly the int main() situation, with just a couple minor syntax errors...once again, thanks for the help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Crazy loss of focus issue (i think)
    By AtomRiot in forum C# Programming
    Replies: 2
    Last Post: 06-18-2007, 03:35 PM
  2. Replies: 6
    Last Post: 04-12-2002, 08:33 AM
  3. Homework help
    By Jigsaw in forum C++ Programming
    Replies: 2
    Last Post: 03-06-2002, 05:56 PM
  4. A (complex) question on numbers
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 02-03-2002, 06:38 PM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM