Forum: C++ Aug 8th, 2008 |
| Replies: 15 Views: 1,431 @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: 19 Views: 1,991 Oh, right. At a glance I thought they were method declarations, not prototypes for global functions. |
Forum: C++ Aug 7th, 2008 |
| Replies: 19 Views: 1,991 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: 509 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: 17 Views: 1,658 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 Views: 1,643 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 Views: 1,643 Wait - you're saying to not use variables of type bool? |
Forum: C++ Aug 4th, 2008 |
| Replies: 4 Views: 2,095 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: 4 Views: 2,095 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: 2 Views: 1,730 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: 18 Views: 1,643 ( 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 1st, 2008 |
| Replies: 22 Views: 3,851 *sigh*
Okay, you want to know where to start. I've never written an AVI loader - but here are a couple of places to start (and I don't think where you start is going to be language specific).
... |
Forum: C++ Jul 31st, 2008 |
| Replies: 22 Views: 3,851 Do you need us to lay out the steps of what you need to do? I thought you had already planned that? You want to know how to make a Windows looking GUI? Windows API or MFC, if you've bought it. Here's... |
Forum: C++ Jul 31st, 2008 |
| Replies: 22 Views: 3,851 You must? Was it assigned to you for your job or something? I don't have any industry experience, but I'm pretty sure a decent boss wouldn't give a huge project like this to a single person with... |
Forum: C++ Jul 29th, 2008 |
| Replies: 5 Views: 590 @second error
you wrote itsVectorOfNotebook in one or more places (one of which is line 135 of CTesterClass.cpp) where you should have written itsVectorOfNotebooks.
Could you specify which line... |
Forum: C++ Jul 29th, 2008 |
| Replies: 5 Views: 590 The only insert function of the vector template I found takes two parameters - one of type size_t, and the other of type Item_type. When you call it, you're only specifying the Item_type parameter.
... |
Forum: C++ Jul 27th, 2008 |
| Replies: 6 Views: 2,260 The extraction operator >> skips over whitespace. To read a file character by character including whitespace, use the get() method. Though I would just listen to Ancient Dragon. |
Forum: C++ Jul 27th, 2008 |
| Replies: 5 Views: 3,276 It means that strncpy is old and/or something better is around to use instead of it. |
Forum: C++ Jul 25th, 2008 |
| Replies: 8 Views: 776 It doesn't matter if you're using Express. I had to do the same thing. |
Forum: C++ Jul 24th, 2008 |
| Replies: 8 Views: 776 I myself have run into problems with side by side configuration, and while I don't fully understand it, it is not an issue with Vista. I've run into the same problem when moving an app from one xp... |
Forum: C++ Jul 24th, 2008 |
| Replies: 11 Views: 1,192 int converter(int x, int y)
{
if(y == 0)
return 0;//or -1, or whatever you want to happen instead of a divide by zero
return x / y;
}
You could use backspace to get rid... |
Forum: C++ Jul 24th, 2008 |
| Replies: 11 Views: 1,192 You might want to also add a check in converter() (or somewhere else) to make sure that the number of deaths is not 0. |
Forum: C++ Jul 23rd, 2008 |
| Replies: 7 Views: 2,915 It isn't bogus crap. Learn to understand it and you'll begin to be able to solve problems on your own, though its understandable that at first you'll have no idea what it means.
The compilers... |
Forum: C++ Jul 23rd, 2008 |
| Replies: 14 Views: 1,018 scratch this - didn't see the second page
btw, how do you get the code tag to come up properly without it thinking it's an actual code tag? |
Forum: C++ Jul 23rd, 2008 |
| Replies: 7 Views: 2,915 It has to do with the way your compiler is interpreting strings (I think it happens when you set the character encoding to unicode instead of multibyte, or something like that).
I think that this:... |
Forum: C++ Jul 23rd, 2008 |
| Replies: 14 Views: 1,018 Salem meant you should wrap your code in code tags (the # button on the top, or just type [ code] YOUR CODE HERE [/code], w/o the spaces between '[' and "code").
Do you want the for loop to be... |
Forum: C++ Jul 23rd, 2008 |
| Replies: 11 Views: 1,511 That won't work. The symbol Pizza is only defined in your program to mean 10. When you type in "Pizza" at the console, it's interpreting it as a char* (I think), and I don't know how that translates... |
Forum: C++ Jul 23rd, 2008 |
| Replies: 11 Views: 1,511 When you run the program, and you want to guess that your favorite food is pizza, do actually type in "pizza", or do you input 10? |
Forum: C++ Jul 23rd, 2008 |
| Replies: 8 Views: 6,359 To address your first issue: void pointers. Google it. It's basically a pointer that has no type bound to it. I haven't used them too much but I think they fit your needs.
Your second problem:... |
Forum: C++ Jul 22nd, 2008 |
| Replies: 6 Views: 549 Google is very nice:
link (http://msdn.microsoft.com/en-us/library/9yb20073(VS.71).aspx)
As others have said, post code, but this, or something like it, would cause the problem you're having:
... |
Forum: C++ Jul 22nd, 2008 |
| Replies: 11 Views: 997 Wait, so every compiler is considered to have it's own "implementation" of C++? So, is it possible to have a compiler that compiles pure C++, or is pure C++ just a language on paper?
Or did you... |
Forum: C++ Jul 21st, 2008 |
| Replies: 6 Views: 1,163 |
Forum: C++ Jul 20th, 2008 |
| Replies: 4 Views: 492 exp *= exp when exp is 1 means exp *= 1;, exp = exp*1;, exp = exp;. That increment does nothing. To increase exp by 1 every iteration, do exp += 1;, if that's what you meant. Also, what is exponente?... |
Forum: C++ Jul 20th, 2008 |
| Replies: 7 Views: 1,440 Why are you doing this->Close();? You can just say Close(); if you're within the scope of the function, can't you? (unless you're trying to specify that you're not referring to some external Close()... |
Forum: C++ Jul 20th, 2008 |
| Replies: 10 Views: 1,299 If you're on windows, a common way to do it is system("PAUSE");. It gives a prompt like "Press any key to continue..." |
Forum: C++ Jul 19th, 2008 |
| Replies: 4 Views: 735 Couldn't he also use pointers?
if( TTF_Init() < 0 )
{
return 1;
}
Font* thing = new Font;
delete thing; |
Forum: C++ Jul 17th, 2008 |
| Replies: 6 Views: 486 Can't say I'm 100% sure - but after looking at it a bit I'm pretty sure:
You have two enumerations. The first is gender, which is declared and defined in global scope. The second is... |
Forum: C++ Jul 16th, 2008 |
| Replies: 6 Views: 486 Err, what exactly is the error you get? From what line? |
Forum: C++ Jul 15th, 2008 |
| Replies: 15 Views: 1,501 What errors did you get? What was the wrong order and what was the order that worked? |
Forum: C++ Jul 14th, 2008 |
| Replies: 5 Views: 2,878 If you'd like to link to a lib through the compiler's interface rather than using #pragma, right-click on your project's name in the panel to the left, go down to properties, expand linker, go to... |