Forum: C++ Jul 30th, 2009 |
| Replies: 4 Views: 236 Perhaps take a look at bitset (http://www.sgi.com/tech/stl/bitset.html)?
Or you can do it "manually":
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1074727388&id=1073086407
Keep in... |
Forum: C++ Jul 22nd, 2009 |
| Replies: 3 Views: 810 >Is this array initialization static or dynamic?
It's called a variable-length array (http://en.wikipedia.org/wiki/Variable-length_array), and as far as you're concerned, it's static. However, as... |
Forum: C++ May 18th, 2009 |
| Replies: 10 Views: 616 That's because you didn't read (or didn't understand) what was said in this link:
http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12
The whole cause of the problem stems from the fact... |
Forum: C++ Apr 27th, 2009 |
| Replies: 6 Views: 577 The same way you would add characters to a static array. The only difference being that you're responsible for allocating and deallocating the memory that 'arr' is going to point to. |
Forum: C++ Apr 27th, 2009 |
| Replies: 2 Views: 459 >numarray = readFile(numarray[])
Remove the [] and it'll pass the address of the starting element of the array. You also don't need to bother returning the array, since you've passed the memory... |
Forum: C++ Apr 26th, 2009 |
| Replies: 8 Views: 484 >MyTemplate<SomeClass> var;
Most compilers will give you an error not only on the line that attempts to use a member that a derived template class doesn't possess, but also the line that the class... |
Forum: C++ Apr 26th, 2009 |
| Replies: 8 Views: 484 If you're only ever going to derive one class from your template, why are you making it a template?
Nevertheless, if for whatever reason you need it:... |
Forum: C++ Apr 26th, 2009 |
| Replies: 14 Views: 922 >im running Linux so i dont think i can view the XPS files.
1. Look directly below the XPS downloads, and you'll see PDF downloads.
2. FYI: http://www.artifex.com/downloads/ |
Forum: C++ Apr 26th, 2009 |
| Replies: 8 Views: 450 Why are you putting so much effort into shoehorning your code onto a dinosaur of a compiler? Yea, you may have "fixed" this issue but that's only one of hundreds of problems you'll encounter with a... |
Forum: C++ Apr 4th, 2009 |
| Replies: 2 Views: 1,156 http://www.parashift.com/c++-faq-lite/templates.html#faq-35.18 |
Forum: C++ Mar 20th, 2009 |
| Replies: 1 Views: 447 The GNU implementation of copy_n is in the __gnu_cxx namespace. Try putting
using __gnu_cxx::copy_n
after your #include and your program should compile fine. |
Forum: C++ Mar 9th, 2009 |
| Replies: 11 Views: 1,176 Perhaps I'm misunderstanding.
class MyClass
{
public:
char mystring[15];
};
void function1()
{ |
Forum: C++ Mar 9th, 2009 |
| Replies: 3 Views: 386 You don't seem to understand the concept of using an object. An object has its own data members, which are abstracted from a function like main(). Once you set the rectangle's width and length, you... |
Forum: C++ Jan 10th, 2009 |
| Replies: 5 Views: 356 If I understand your question correctly, you want a simpler method for reading files. I suppose you could write a simple function that returns all the lines of text as a vector of strings:... |
Forum: C++ Oct 12th, 2008 |
| Replies: 14 Views: 1,054 Is this a purely console-based program, or does it use some sort of windowing libraries? Does the program work if you build it under the 'release' configuration? |
Forum: C++ Aug 2nd, 2008 |
| Replies: 1 Views: 1,015 Assuming you're using .NET, that would be the Checked member of the RadioButton class. |
Forum: C++ Feb 27th, 2008 |
| Replies: 28 Views: 1,984 A library that's written by a third party (i.e. a company other than your compiler vendor). |
Forum: C++ Feb 27th, 2008 |
| Replies: 28 Views: 1,984 You can't use cin like that, because your shell is most likely in canonical mode. Basically what happens is the shell waits for the user to give a newline before it supplies your input buffer with... |
Forum: C++ Feb 27th, 2008 |
| Replies: 9 Views: 1,048 if (LabGrade = 'A' && 'a')
While this is a valid C++ statement, it has several problems:
- = is an assignment operator. You probably want to use the comparison operator, ==.
- The '&&' operator... |
Forum: C++ Feb 19th, 2008 |
| Replies: 3 Views: 1,429 How do you expect the first character of the token to print out when you have never written in your code that the first character should be printed? C++ does exactly what you tell it to do, no more.... |
Forum: C++ Feb 19th, 2008 |
| Replies: 2 Views: 1,706 How about
Text1and2 = Text1 + Text2; |
Forum: C++ Feb 19th, 2008 |
| Replies: 3 Views: 1,429 This probably won't cause too many problems, but just for consistency's sake, use an integer:
char length = strlen(tokenPtr);
What does this line do?
cout << tokenPtr[length];
Think carefully... |
Forum: C++ Feb 17th, 2008 |
| Replies: 3 Views: 1,934 Please use CODE tags when posting code. Their usage is explained in the watermark that you typed over when you wrote your post, and in the announcements in this forum.
As for your problem, it's... |
Forum: C++ Feb 15th, 2008 |
| Replies: 19 Views: 1,803 Use the noparse tag. E.g.
code goes here
Turns into
code goes here
To show the noparse tag in your post, use another noparse tag. |
Forum: C++ Feb 13th, 2008 |
| Replies: 19 Views: 1,803 I refuse to read your code until it's properly formatted. |
Forum: C++ Feb 13th, 2008 |
| Replies: 25 Views: 5,603 Oh yeah, I forgot that thread starters could do that. :icon_cheesygrin: My bad. |
Forum: C++ Feb 12th, 2008 |
| Replies: 25 Views: 5,603 >now how do i delete this thread?
We don't delete threads just because the original poster's question is answered. However, if you want, a moderator can mark this thread as "solved". |
Forum: C++ Feb 10th, 2008 |
| Replies: 12 Views: 13,584 >Might you explain how to put a pointer to the scope of that method?
I don't know the details of your program, so I can't really be very specific. Basically you would create a pointer of type int **... |
Forum: C++ Feb 10th, 2008 |
| Replies: 12 Views: 13,584 If it was created inside a member function, then the pointer is a local variable (even if the data isn't) and thus you'll lose the address of the data outside of the function. Either you need to... |
Forum: C++ Feb 9th, 2008 |
| Replies: 12 Views: 13,584 >Well I want to pass an array that is inside the class, how I do that?
I'm assuming you mean that the array is a member of matrix. In that case, you'd call the function like this:... |
Forum: C++ Feb 9th, 2008 |
| Replies: 12 Views: 13,584 Well, that's because you coded your function to accept int ** as a parameter, and you're calling it without any arguments. |
Forum: C++ Feb 9th, 2008 |
| Replies: 74 Views: 14,055 At the moment I don't have access to a debugger, nor do I feel like adding lots of couts to see where your program goes wrong. Glancing over your code, there's nothing obviously wrong, so I'll... |
Forum: C++ Feb 9th, 2008 |
| Replies: 74 Views: 14,055 |
Forum: C++ Feb 8th, 2008 |
| Replies: 74 Views: 14,055 For lines 24 and 25, shouldn't it be like this?
result.poly.push_back(p1.poly[i]);
result.poly.push_back(p2.poly[j]); |
Forum: C++ Feb 8th, 2008 |
| Replies: 12 Views: 13,584 So what you're saying is that you have a function called ManiMatrix which is supposed to call customMatrix.checkIfMagic()? In that case, could you post the the line in which you call checkIfMagic()... |
Forum: C++ Feb 8th, 2008 |
| Replies: 74 Views: 14,055 >So to answer that question, no, it isn't a member of polynomial. So i guess i should have
>the '<' operator in my term struct?
Yes. At the moment you're overloading a comparison for Polynomial <... |
Forum: C++ Feb 8th, 2008 |
| Replies: 74 Views: 14,055 >I figured i'll just implement the STL's sorth algorithm and am able to do this as long as i have
>a less than operator defined right?
You don't 'implement' it, you just make sure that the '<'... |
Forum: C++ Feb 8th, 2008 |
| Replies: 74 Views: 14,055 I apologize, I'm kind of jumping into this thread without having read the rest of it, but you're using iterators wrong here:
if(*it->expo == *it2->expo && *it->var == *it2->var)
The *'s are... |
Forum: C++ Feb 8th, 2008 |
| Replies: 5 Views: 1,483 You might want to try something like dyndns.com (http://www.dyndns.com/). Register a free subdomain from a predefined list of domains, and then you can download a client... |
Forum: C++ Feb 8th, 2008 |
| Replies: 7 Views: 13,475 As far as I know, Dev-C++ works on Windows Vista. You can also download and use Visual Studio 2008 Express Edition for free, see http://www.microsoft.com/express/ for more information. |