Forum: C++ Aug 2nd, 2009 |
| Replies: 1 Views: 236 Folks,
I'm having some trouble with overloading the '<<' operator for a templated class. For example, given a very simple template class like this:
template<class T = double> class Real... |
Forum: C++ Apr 6th, 2009 |
| Replies: 4 Views: 1,882 I'm not a .NET programmer but according to the documentation:
IntPtr hwnd = process->Handle;
Which compiles successfully as a CLR console program. |
Forum: C++ Apr 6th, 2009 |
| Replies: 1 Views: 407 First, using the same name for an argument and a global is confusing (string encoding)...if you are using it as a constant, make sure you initialize it (not all compilers will do this for you,... |
Forum: C++ Mar 30th, 2009 |
| Replies: 19 Views: 1,625 Actually, since it appears that the program scans the chessboard visually you should be able to adapt it to the 'new' chessboard layout. It's really just a matter of changing it so that it... |
Forum: C++ Mar 24th, 2009 |
| Replies: 5 Views: 695 Global variables are defined in a header file (so that various cpp files that include it can see it). Setw is defined in iomanip so this must be included where needed. Also, you are trying to use... |
Forum: C++ Mar 23rd, 2009 |
| Replies: 9 Views: 619 I've seen .txx, or variants thereof, it is for compiled template files. Usually the contents of these are various things that need to be compiled to use a given template library, such as... |
Forum: C++ Mar 17th, 2009 |
| Replies: 16 Views: 408 Ah, I just noticed a bit on the SDL site; the video portion is implemented via OpenGL ;P
The GLUT (openGL Utility Toolkit) library simplifies window management, and drawing within the window,... |
Forum: C++ Mar 17th, 2009 |
| Replies: 16 Views: 408 OpenGL is supported on almost all platforms as well, and there is a utility library (GLUT) which is built on top of OpenGL that is pretty easy to use, and handles windows and messaging, etc. in a... |
Forum: C++ Mar 17th, 2009 |
| Replies: 16 Views: 408 If you are on Windows, drawing is handled in the GDI+ library (for most 2D tasks); it is both simple and fairly powerful for drawing in 2D in a Window, and it supports printing also. If you are... |
Forum: C++ Mar 16th, 2009 |
| Replies: 5 Views: 393 The way the code is structured is somewhat strange, in that you do not allow user input after each question (which is why you get all 3 questions output at once). A more intuitive approach would be... |
Forum: C++ Feb 28th, 2009 |
| Replies: 5 Views: 366 Help yes. Writing code for others, no, sorry ;P
Thanx...
Sean |
Forum: C++ Feb 28th, 2009 |
| Replies: 3 Views: 593 Okay, examine the first loop statement:
while(n >= n)
is an obvious first problem...a variable is *always* going to be equal to itself under any competent compiler.
Thanx...
Sean |
Forum: C++ Feb 25th, 2009 |
| Replies: 16 Views: 667 the second example would work, assuming that you declare:
void getHours(int& input1, string& s);
at the top and the definition is:
void getHours(int& input1, string& s)
{
cout << s;
cin... |
Forum: C++ Feb 24th, 2009 |
| Replies: 11 Views: 509 What you've got works, since the if/else loop code is actually only a single statement. I would recommend, however, that you include brackets for clarity and ease of maintenance; it doesn't cost... |
Forum: C++ Feb 18th, 2009 |
| Replies: 2 Views: 787 Well, at first blush (I haven't tested it) you may need to specify
getline<wchar_t>( File, Line );
Hope it helps,
Sean |
Forum: C++ Jan 22nd, 2009 |
| Replies: 2 Views: 407 You are adding an array to a string; keep in mind that some versions of length of string funtions count the NULL terminator, some don't...you need to know which is which. Otherwise, you get a... |
Forum: C++ Jan 22nd, 2009 |
| Replies: 7 Views: 521 if for some reason you cant use stl, you coulc have buffers that hold up to a set amount;in other words keep a large buffer aside that holds, say 4000 characters, as soon as it is full use the next... |
Forum: C++ Jan 22nd, 2009 |
| Replies: 2 Views: 223 First, this is not a place for us to write your homework for you. If you have specific questions regarding C++ please post what you have written and what is not working, and we will try to help. ... |
Forum: C++ Dec 1st, 2008 |
| Replies: 3 Views: 294 Is there a specific reason you need this from the registry? Graphics packages include this ability, as well as the ability to enumerate the different cards on a machine if there are multiple. It's... |
Forum: C++ Dec 1st, 2008 |
| Replies: 3 Views: 496 Oh...
Right the compiler can avoid making the copy on return. What he said. Sorry, waas a bit distracted there...
Sean |
Forum: C++ Dec 1st, 2008 |
| Replies: 3 Views: 496 in the call to the operator+ you use [/code]
String temp;
[/code]
which invokes the default constructor.
Thanx,
Sean |
Forum: C++ Nov 21st, 2008 |
| Replies: 5 Views: 997 The Standard Template Library has a dynamically sizable array type, a linked list type, and generally a whole bunch of useful stuff that makes this easy, called the STL. The problem with STL is that... |
Forum: C++ Nov 21st, 2008 |
| Replies: 4 Views: 475 It's a bit unusual, but is one of the extensions usable for C++ header files. |
Forum: C++ Nov 19th, 2008 |
| Replies: 5 Views: 593 This is not really a standardized thing, in my knowledge. For many reasons, it is usually a pretty involved platform specific thing, as terminating aother program is considered unsafe. There are... |
Forum: C++ Oct 29th, 2008 |
| Replies: 5 Views: 408 Correct, it is common to define a 'delta' which is the amount of error you wish to tolerate, and to correct the value as it drifts.
Thanx...
Sean |
Forum: C++ Oct 29th, 2008 |
| Replies: 8 Views: 606 I thing that is confusing about the code is that you are using 2 different variables with the same name;
in the class you have a member variable "string partDescrop"
you also have a local... |
Forum: C++ Oct 29th, 2008 |
| Replies: 4 Views: 524 Sure ;)
the class nsFTP (the first link error) is declared in FTPDataTypes.h, which comes with the demo source, along with several other header files...make sure you #include these headers and... |
Forum: C++ Oct 29th, 2008 |
| Replies: 4 Views: 524 Please tell what the errors are so we have something to go on...
Thanx...
Sean |
Forum: C++ Oct 29th, 2008 |
| Replies: 21 Views: 1,468 function bodies (definitions) should reside in a .cpp file, not a header file; the functions are being defined multiple times the way they are written (every file you include the header file in).
... |
Forum: C++ Oct 28th, 2008 |
| Replies: 8 Views: 606 I can't see precisely the problem because I don't have enough code, really...but you should have a member in the class:
string mPartDescription;
and this member string should be the one that is... |
Forum: C++ Oct 28th, 2008 |
| Replies: 5 Views: 408 [QUOTE=Dontais;723659]I'm trying to run my program and when I enter say 3 it gives me a fatal error. It is suppose to calculate the avg of each value entered and output it. Would appreciate a little... |
Forum: C++ Oct 27th, 2008 |
| Replies: 9 Views: 668 Yes, it is a good book but not targeted at beginners. A book that I always keep on my shelf is "the C/C++ Programmer's Bible"...not sure what edition is out write now. It is huge, but breaks... |
Forum: C++ Oct 27th, 2008 |
| Replies: 5 Views: 1,000 Well you have the base class already: Quafrilateral. That goes on top. Next in hierarchy would be the ones that are the closest to a quadrilaterl, that is, they share the same properties. Making... |
Forum: C++ Oct 23rd, 2008 |
| Replies: 3 Views: 487 Thank you very much folks...just hadn't really run into that particular issue before.
Thanx...
Sean |
Forum: C++ Oct 22nd, 2008 |
| Replies: 4 Views: 724 Need a bit more to go on...what are you trying to accomplish? |
Forum: C++ Oct 22nd, 2008 |
| Replies: 9 Views: 530 This is actually C, not technically C++, btw. You mention pointer to member functions but so far all I see is a standard function declaration and definiton. No function pointers...could you... |
Forum: C++ Oct 22nd, 2008 |
| Replies: 4 Views: 392 The function definition is not being included in your test.cpp module, so the linker can't find it. Often inline function definitions are saved as a different type of file (like test.inl) which is... |
Forum: C++ Oct 22nd, 2008 |
| Replies: 3 Views: 884 Well, I'm not sure what the array has in it. or what the application is doing, but given the function, yes. You left out a closing brace at the end of the for loop. This actually is C stuff, not... |
Forum: C++ Oct 21st, 2008 |
| Replies: 3 Views: 884 well, for [0][0] to [0][9] (bear in mind that arrays start at 0) you would just have the one loop:
for( int i = 0; i < 10; i++ ){
emp[0][i].viewEMP();
}
Sean |
Forum: C++ Oct 21st, 2008 |
| Replies: 3 Views: 487 Hi There!
Quick, probably dumb question but I have the following snippet
template<typename T>
class Natural : public ArbitraryNumber{
std::vector<T> mVal;
std::vector<T>::iterator... |