jimblumberg's Profile User Rating: *****

Reputation: 4071 Guru
Active Posts:
13,255 (7.67 per day)
25-December 09
Profile Views:
Last Active:
User is offline Yesterday, 09:24 PM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
Expert In:

Latest Visitors

Icon   jimblumberg has not set their status

Posts I've Made

  1. In Topic: SDL Help! Specifically getting mouse motion to work...

    Posted 18 Sep 2014

    If you want help you'll definitely need to post the relevant code.

  2. In Topic: random number game

    Posted 18 Sep 2014

    Because you're using the || any time tries is equal to or greater than 5 the the second statement. Also note you don't need that last else if a simple else would be better.

  3. In Topic: Inventory System

    Posted 18 Sep 2014

    Okay first some questions:

    1. Why are you using C-strings in the Weapon class instead of the std::string like you're using in your other class?

    2. Why are you using arrays instead of std::vector? The vector will make it easier to remove and add items to your "inventory" because it's size is dynamic.

    3. Why isn't inventory a class that contains things like weapons, armor, food, medicine, etc.?

    Now to your questions:

    1. I really don't understand what you're asking here, so perhaps you can rephrase the question.

    2. With arrays, you need to copy the elements to the new location, and assign "empty" values to the last item. With a std::vector you can just erase() the element.

    3. Look at three above.

    4. What makes you think your current code is "customizable"?

    5. Although I think you might not be ready for it, you might want to consider "polymorphism". See these links: Introduction to Polymorphism in C++ and Polymorphism.

    And a couple of notes:

    1. You don't usually need to call the file stream close methods unless you plan to reuse them within the same scope, the destructor automatically closes the files.

    2. You really need to consider more functions if you want to make your program more "customizable".

    3. Using the extraction operator with strings means that there can be no spaces in the string, so things like "Two Handed Sword" will not be allowed. Consider using getline() for your strings.

    4. Instead of printing each individual item of your classes you should consider either overloading the stream insertion operator>> or create a "print" function in your classes.

    5. Your structures should be classes, and the variables should be private and you should have functions to manipulate the class instead of allowing direct access to the data.

  4. In Topic: How to get my program to read values from a file

    Posted 18 Sep 2014


    Hi jim my teacher wants us to use the same file for output becuase its suppose to calculate what quadrant the points lie on

    That doesn't make any sense. What does outputting the results have to do with reading your file. When you add information to that file you will probably have problems reading the file in the future. You are better off writing either to the console or to a totally different file.

    Next looking at your input file:
    1 3
    -4 10
    9 7
    8 -3

    It looks like you have multiple "points" that you need to read, so you'll probably want to use a loop of some sort, and definitely not use the same file for output. And your "points" should probably be integers not doubles.

  5. In Topic: How to get my program to read values from a file

    Posted 18 Sep 2014

    Perhaps you need to review basic file input and output?

    And without knowing exactly what the input file contains it is hard to say how to read the file. And why are you opening the same file for output? I recommend using a different file name for your output.


    I'm getting an error message that my quadrant for lines 45 and 51 not being declared

    It appears that you may want to check the spelling of your variable.


My Information

Member Title:
Age Unknown
December 6

Contact Information



Page 1 of 1
  1. Photo

    KnifeTea Icon

    11 May 2014 - 05:55
    thanks for the help Jim!
  2. Photo

    tarmizi_adam2005 Icon

    04 Dec 2013 - 07:15
    Just stopping by to say Hello Jim. I've learned quite a few things from your posts in the c/c++ forum.
Page 1 of 1