Search Results

Showing results 1 to 40 of 305
Search took 0.04 seconds.
Search: Posts Made By: CoolGamer48 ; Forum: C++ and child forums
Forum: C++ Jan 10th, 2009
Replies: 6
Views: 1,721
Posted By CoolGamer48
Ahh.... I figured it out. Somewhere in the methods of my class I was catching the exception that would normally be thrown as an std::exception and re-throwing it (not really sure why I had done...
Forum: C++ Jan 9th, 2009
Replies: 6
Views: 1,721
Posted By CoolGamer48
hmm.... well, i defined a function:

void func()
{
throw Surface::image_load_failed("my error");
}


and called that from my try block, which resulted in the output I would have expected...
Forum: C++ Jan 7th, 2009
Replies: 6
Views: 1,721
Posted By CoolGamer48
I have a child of std::exception defined as:

struct image_load_failed : public std::exception
{
image_load_failed(std::string const s) : message(s) {}
virtual ~image_load_failed() throw()...
Forum: C++ Nov 21st, 2008
Replies: 4
Views: 500
Posted By CoolGamer48
Does anyone actually use the .hpp file extension for C++ header files? I've never seen it used, but I was just working with geany, and I noticed that it only syntax highlights C++ specific things if...
Forum: C++ Aug 18th, 2008
Replies: 6
Views: 768
Posted By CoolGamer48
Err... ok, ran into a prob again (like my first one). fyi ive gone back to the multiple member system (r,g,b,a as four separate variables). I still can't figure out how to let users pick whether or...
Forum: C++ Aug 18th, 2008
Replies: 6
Views: 768
Posted By CoolGamer48
Oh, you're right.

But actually, I dropped the system of using different members for red, green, blue, and alpha. I'm just using a single hex value as a member to save space.

Edit:
Just...
Forum: C++ Aug 17th, 2008
Replies: 6
Views: 768
Posted By CoolGamer48
Wow, nvm - just figured it out.

Have alpha be first, not last.

But if someone could confirm that and/or check the above code I'd appreciate it.
Forum: C++ Aug 17th, 2008
Replies: 6
Views: 768
Posted By CoolGamer48
Hey

I'm writing a color class, and I want to have a constructor that can take in an unsigned int like 0x00FF00FF and interpret it as fully opaque green. I have code for that (I think it should...
Forum: C++ Aug 10th, 2008
Replies: 4
Views: 746
Posted By CoolGamer48
So #import is specific to Obj-C?
Forum: C++ Aug 10th, 2008
Replies: 4
Views: 746
Posted By CoolGamer48
Hey,

I'm learning Objective-C, and they use #import "File.h" instead of #include "File.h". The tutorial I'm using says that import is like an include once thing, and it basically implements the...
Forum: C++ Aug 9th, 2008
Replies: 7
Views: 1,241
Posted By CoolGamer48
Wait, are you talking about this line:

*drawn = rand() % 52+1;


rand() returns an int but drawn has been dereferenced so isn't it also of type int?
Forum: C++ Aug 8th, 2008
Replies: 15
Solved: namespace std
Views: 1,441
Posted By CoolGamer48
@williamhemswort
namespaces shouldn't end with a semicolon (though AD didn't point that out so I'm not sure I'm right about that...). I also don't think non const variables can be defined outside a...
Forum: C++ Aug 8th, 2008
Replies: 5
Views: 1,306
Posted By CoolGamer48
The reason the line you commented isn't working is because save.dna[i] is of type char, but "T" is of type char* (I believe, maybe it depends on the compiler?). Try changing it to 'T'
Forum: C++ Aug 8th, 2008
Replies: 19
Views: 2,016
Posted By CoolGamer48
Oh, right. At a glance I thought they were method declarations, not prototypes for global functions.
Forum: C++ Aug 7th, 2008
Replies: 10
Views: 880
Posted By CoolGamer48
Don't use spaces between in the code tags for them to work.

That code is swapping the variables word[i] and word[j]. Temp is needed to do the switch (at least the way it's being done here).

Say...
Forum: C++ Aug 7th, 2008
Replies: 19
Views: 2,016
Posted By CoolGamer48
Post the errors and a description of your problem/question.

edit: Sorry, didn't see the comments in your code. Still good to post a description of the issue though.

I see a couple of strange...
Forum: C++ Aug 7th, 2008
Replies: 4
Views: 518
Posted By CoolGamer48
Um, when you say thread, you mean like a multi-thread program, where each thread gets its own share of processor time? I don't have much experience with multi-threading so I don't know if/how it's...
Forum: C++ Aug 7th, 2008
Replies: 4
Views: 511
Posted By CoolGamer48
1. You didn't listen to one of the above posters. Don't do this:
cin >> name;

If I type a name that's larger than 20 characters your program will crash.

2. Unless this is for a class and your...
Forum: C++ Aug 7th, 2008
Replies: 4
Views: 629
Posted By CoolGamer48
Do you indeed want to make it have a GUI? If so, follow linux0id's advice - you're going to need to use some sort of API.
Forum: C++ Aug 7th, 2008
Replies: 4
Views: 518
Posted By CoolGamer48
Any method of the mainFrame class has access to both m_library and m_player.

So you can have a method called GetNextTrack() (or w/e):

class mainFrame : public Gtk::Window
{
public:
...
Forum: C++ Aug 7th, 2008
Replies: 2
Views: 401
Posted By CoolGamer48
Are you on a console? If so, I don't think there's a good, definite way to do that (though I could be wrong).
Forum: C++ Aug 7th, 2008
Replies: 17
Views: 1,686
Posted By CoolGamer48
Kind of off topic, but strcpy() is meant for use with C-Strings (i.e., char*). When using std::strings (which you should :) )you use the (overloaded? ) assignment operator.
Forum: C++ Aug 5th, 2008
Replies: 18
Solved: enum warnings
Views: 1,667
Posted By CoolGamer48
I don't understand why it says assigning either. If it said casting or converting or something like that then I would get it. Because true really isn't of type int, it's of type enum bool, so when...
Forum: C++ Aug 5th, 2008
Replies: 18
Solved: enum warnings
Views: 1,667
Posted By CoolGamer48
Wait - you're saying to not use variables of type bool?
Forum: C++ Aug 5th, 2008
Replies: 24
Views: 3,653
Posted By CoolGamer48
A vector (http://www.cplusplus.com/reference/stl/vector/vector.html) is a dynamic array. You can use the push_back() method to add an element to the end of the vector, and you can use the overloaded...
Forum: C++ Aug 5th, 2008
Replies: 7
Views: 858
Posted By CoolGamer48
You've got the basic idea right I think - just some minor typos and mistakes. I don't want to point out all of them - try to figure them out - read over the program (some lines in particular you may...
Forum: C++ Aug 5th, 2008
Replies: 7
Views: 858
Posted By CoolGamer48
The above post could have been a place to post your errors - but no matter.

Get rid of this line: struct Weather;

Move the definition of the month struct to where the struct Weather line was.
...
Forum: C++ Aug 5th, 2008
Replies: 7
Views: 858
Posted By CoolGamer48
Always post your errors!

struct Weather
What is this? The syntax is improper and I'm not sure what you're trying to do.


month[0] = January;
month[1] = February;
month[2] = March;
month[3]...
Forum: C++ Aug 4th, 2008
Replies: 24
Views: 3,653
Posted By CoolGamer48
It might not be that simple if you also need to keep track of whether a member is full or young. You would need to output that in some form to your text file, and then as you read the data, create an...
Forum: C++ Aug 4th, 2008
Replies: 4
Views: 2,132
Posted By CoolGamer48
the string::c_str() method converts the contents of an std::string to const char*. For example:

string str1 = "Hello";
const char* str2 = "Hello";
str1.c_str();//would return a value equivalent...
Forum: C++ Aug 4th, 2008
Replies: 24
Views: 3,653
Posted By CoolGamer48
Oh - sorry, there was an error in my overloaded extraction operator:

ifstream& operator>>(ifstream& fin,MemberRecord& mem)
{
fin >> mem.name >> mem.age >> mem.balance;
return fin;
}
Forum: C++ Aug 4th, 2008
Replies: 4
Views: 2,132
Posted By CoolGamer48
Always post the exact errors you get for the best help.

atio() (http://www.cplusplus.com/reference/clibrary/cstdlib/atoi.html) takes input of type const char*.

do this:

x=atoi(str.c_str());...
Forum: C++ Aug 4th, 2008
Replies: 4
Views: 752
Posted By CoolGamer48
Right - that's mouse input. You need to be able to know when and in what direction the mouse moves and when buttons are pressed. Like I said - you can use DirectInput.
Forum: C++ Aug 4th, 2008
Replies: 24
Views: 3,653
Posted By CoolGamer48
firstly, you need to have a structure that can hold all the data that you need. In the example, this would be vector<MemberRecord>. As far as loading a MemberRecord into your program, you have a...
Forum: C++ Aug 4th, 2008
Replies: 4
Views: 752
Posted By CoolGamer48
What exactly is mouse handling? Do you mean reading mouse input? DirectInput is an expensive solution - there may be some simpler methods in the Win32 API.
Forum: C++ Aug 4th, 2008
Replies: 2
Views: 1,762
Posted By CoolGamer48
This: module = new MyClass(true); line should not work in either case. module is of type MyClass, but new MyClass(true) is of type MyClass*. That assignment shouldn't work - are you sure the latter...
Forum: C++ Aug 4th, 2008
Replies: 24
Views: 3,653
Posted By CoolGamer48
A text database file is just your text file.
Forum: C++ Aug 4th, 2008
Replies: 18
Solved: enum warnings
Views: 1,667
Posted By CoolGamer48
( x || y ) is an expression of type bool (at least I think so - even though you can't declare variables of type bool it still exists as a type)

true is of type int. I believe this comparisan of...
Forum: C++ Aug 4th, 2008
Replies: 24
Views: 3,653
Posted By CoolGamer48
For reading data from text files: ifstream (http://www.cplusplus.com/reference/iostream/ifstream/)
Forum: C++ Aug 4th, 2008
Replies: 5
Views: 2,388
Posted By CoolGamer48
It is considered one of the "harder" languages, but as AncientDragon said, hard is a relative term. C++ was really the first language I learned, and I didn't have any real experience with other...
Showing results 1 to 40 of 305

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC