Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Help with C++

Name: Anonymous 2006-07-16 14:29

I'm learning how to write a roguelike, and it's pretty much the first real programming project i have ever done. I have studied C++ for a bit at school and on my spare time, but i know only the basics, and i thought that programming a simple game would be good learning. I'm trying to make a character creator where you choose a race and a class, then the program rolls your stats, adding different bonuses based on classes and races, but i run into this error:

100 C:\Dev-Cpp\char.c statement cannot resolve address of overloaded function

I'm trying to write the stats to a simple text file, but the program tells me that. What gives?

Name: Anonymous 2006-07-18 4:34

>>3
PROTIP: system("cls") won't work on anything except Windows's sorry excuse for a terminal emulator (well, maybe some versions of DOS, but I doubt you'd have to worry about that in your userbase). Observe:

$ cls
-bash: cls: command not found

The world would be a much better place if every programmer remembered that not everyone uses the same operating system/browser/compiler/terminal/editor as they do.

Making data members of classes public is evil. Never do it (unless you're making a collection of data like the char_traits template that basic_string uses, or something else fancy). Write accessor and mutator functions instead. Rule #1 of object-oriented programming is to keep the internal states of all your objects consistent.

Use std::endl instead of newline, because endl flushes the output buffer.

As three or so people have suggested, use the string class; it'll save you countless headaches.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List