Thanks again
Type: Posts; User: cpudaman
Thanks again
Thanks for the book recommendation.
Can you tell me the date on your Accelerated C++ Book so I don't accidentally buy another outdated one?
I believe Cyberfish already helped you:
I've done most of the tutorial on this site and began to get into C++ programming. So I figured I'd get one of the recommended books.
I got "The C++ Programming Language" by Bjarne Stroustrup....
I use Code::Blocks with the compiler that comes with it - GNU GCC Compliler - to make my programs, and I just finished my second one, and I found the first compiled program with some effort. But now...
I just started trying to learn that, and I agree fully with you, it is not for begginers ( aka me)
Yes, I do know how to use cin/cout. I will look into that tutorial. Thanks for all the help.
Isn't that C style coding.
Also, either I don't understand you fully, or I didn't explain my question well enough. I have several numbers that I would like to store to a file so that a user can save...
I was wondering if you could save and recover numbers from files. The tutorial didn't really say anything about it. Although it does talk about ASCII.
Thanks to both of you for your help, I thought I might be messing up my computer or something.
ok, I guess that makes sense. Just out of curiousity, where do these garbage values come from.
Ok...When I declare a variable. For this case, lets say x, but it doesn't really matter. I call upon x and it is just a massive seven or more digit number. I haven't even set x to anything yet, so...
Do I have to use typecasting to get a number displayed onto a string?
Or is there a better method?
ok, that makes sense. thanks.
But just one last question...If I'm referencing a class that is elsewhere, why do I have to construct the class as if i'm making a new one?
also, there is now...
That fixed the problem with 'new_weapon1' not being defined, but the other problems still occur
[QUOTE=laserlight;703970]Not quite. Here is one approach, using a member variable:
#include <iostream>
using namespace std;
class item {
public:
void use() {
cout << "This...
person(const item& new_item) : item1(new_item) {}
I don't quite understand how this part works^.
I know that it is part of an initialization list, but how does that work to set up a bunch of...
Yeah, that sounds more convienient to me as well, since I don't have to pass a whole bunch of variable around individually to make everything work the way i want it to. I'll read up on it.
So make a class within a class?
I'm having some trouble with classes...again. I just can't seem to get my head around them.
I made a class for the player, and classes for the weapons, armor, items, etc that he will use, but...
Thanks for all the help, I got the problem fixed and understand what I did wrong.
I'll try to improve the organization, but I wanted there to be a separate function for the fighting, than...
my example compiles fine...hmmm, I thought I included the problem, here is the full class
class player {
public:
player (int health, int intelligence, int strength, int agility,
...
for writing purposes, i use codeblocks.
class creature {
public:
creature () {}
~creature () {}
int attack () {
power = basic_dmg + mod_dmg;
return power;
}
void takedmg ( int dmg ) {
dmg = dmg - armor;
I was under the impression that all the functions in a class shared the variables that were defined in the class. Was I mistaken? My compiler keeps telling me that the variables in the class haven't...