Forum: C++ Sep 11th, 2007 |
| Replies: 4 Views: 1,425 I think this might work.
#include <iostream>
using namespace std;
class Class1 { };
class Class2 { };
// Specialize two type traits for picking class 1 and class 2. |
Forum: C++ Sep 8th, 2007 |
| Replies: 4 Views: 994 Only if you use the default constructor when making objects. If you do Object obj; then Object has to have a default constructor, but if you do Object obj( arg ); then Object only has to have a... |
Forum: C++ Sep 8th, 2007 |
| Replies: 12 Views: 5,037 I guess because more than just the original poster can benefit from threads. Do you think that useful info should be deleted after a certain amount of time? That doesn't make sense to me. |
Forum: C++ Sep 8th, 2007 |
| Replies: 12 Views: 5,037 robgxxx, you're replying to threads that are three years old... |
Forum: C++ Sep 7th, 2007 |
| Replies: 2 Views: 729 I think you have to do something like this because int** isn't a compatible type with void**.
int i = 123;
int *p = &i;
void pop( void **data ) {
*data = p;
}
int main() { |
Forum: C++ Sep 6th, 2007 |
| Replies: 38 Views: 3,065 You have to be careful here. 'By reference' could mean two things, and only one of them is right. ;) Thef irst by reference is an actual reference in C++ and arrays are not passed by that reference... |
Forum: C++ Sep 6th, 2007 |
| Replies: 2 Views: 3,425 C++ is case sensitive. Change it to list instead of List and if you don't do using namespace std; you have to prefix the name with std.
#include<list>
class MergeSort{
public:
... |
Forum: C++ Sep 6th, 2007 |
| Replies: 10 Views: 1,508 You're not solving anything by asking someone else do to it. And you're not learning anything either. _And_ you're spamming. |
Forum: C++ Sep 6th, 2007 |
| Replies: 3 Views: 958 If _you_ don't solve the question, what do you expect to learn? :( |
Forum: C++ Sep 6th, 2007 |
| Replies: 4 Views: 2,654 The bitset class lets you work with bits, and you can easily print them too.
#include <bitset>
#include <cstdlib>
#include <iostream>
using namespace std;
int main() {
for ( int i = 0;... |
Forum: C++ Sep 6th, 2007 |
| Replies: 10 Views: 1,508 http://www.daniweb.com/forums/announcement8-2.html |
Forum: C++ Sep 6th, 2007 |
| Replies: 10 Views: 1,508 Stop spamming with the same thing, please. All of your questions are pretty much impossible to answer as given, and it seems like you're trying to get free homework help. |
Forum: C++ Sep 6th, 2007 |
| Replies: 4 Views: 2,654 All numbers are stored in binary. Do you mean generate a random number and then save the binary conversion as a string? |
Forum: C++ Sep 6th, 2007 |
| Replies: 38 Views: 3,065 toppings[z] = a[z] ;
If a is declared as a plain int, why are you subscripting it like an array of int? I think you should make the whole thing an array and that'll fix your problem.
void... |
Forum: C++ Sep 6th, 2007 |
| Replies: 1 Views: 799 Any user input has to be validated first. Once you read the string you need to go over it and make sure that all of the parentheses are matched the right way and all of the operators have the right... |
Forum: C++ Sep 6th, 2007 |
| Replies: 33 Views: 3,973 Yeah, but I think you have enough info and code from everyone in this thread to help you write more of your program. It's starting to seem like you're asking us to write it for you. |
Forum: C++ Sep 5th, 2007 |
| Replies: 33 Views: 3,973 I can't, but my teachers like to say that if you don't do something right the first time, you end up doing it again and again to fix the problems. It seems to me that using an array is bad because... |
Forum: C++ Sep 5th, 2007 |
| Replies: 33 Views: 3,973 Because the quick and easy way is usually more costly in the long run? :D
You don't have to read it one byte at a time if that's what you're worried about.
// Get the binary data
char... |
Forum: C++ Sep 5th, 2007 |
| Replies: 33 Views: 3,973 How does that make a difference? A string just handles the memory for the char array instead of making you do it. I don't think there should be any problem with using a string as long as you don't do... |
Forum: C++ Sep 5th, 2007 |
| Replies: 4 Views: 702 Java doesn't compile C++ code. They're different languages... You need a C++ compiler if you want to compile C++ code. |
Forum: C++ Sep 4th, 2007 |
| Replies: 4 Views: 702 You probably have control characters stuck in the code. I think the ?'s in the code you posted mean that the forum can't print them, but that's where they are.
You said Xcode with java tools,... |
Forum: C++ Sep 4th, 2007 |
| Replies: 4 Views: 3,223 You should forget about converting C++ to VB.NET and look for something originally in .NET. It's a lot easier to use the excel library or ADO.NET than to hack the file format as a binary stream. ;)... |
Forum: C++ Sep 3rd, 2007 |
| Replies: 8 Views: 2,147 That's the one that made me wonder if it was practical. All of the examples that look useful to me are too complicated to understand. All of the examples I can grok are kind of pointless. In the... |
Forum: C++ Sep 3rd, 2007 |
| Replies: 8 Views: 2,147 I appreciate your useful help and links, but I don't think I'm smart enough to understand template metaprogramming. Even the simple rebind you showed me before doesn't make any sense... |
Forum: C++ Sep 3rd, 2007 |
| Replies: 6 Views: 1,369 It doesn't work because there's still something in the stream and ignore gets it right away. You should clear the stream first then do ignore or get.
#include <iostream>
using namespace std;
... |
Forum: C++ Sep 3rd, 2007 |
| Replies: 2 Views: 969 getline stops reading when one of three things happen.
EOF is hit on the stream and the eofbit is set
the delimiter for that function call is found. the default is '\n'
the array is filled up... |
Forum: C++ Sep 2nd, 2007 |
| Replies: 8 Views: 2,147 That's a little much for me, thanks. ;) Template metaprogramming looks cool, but is it really practical? |
Forum: C++ Aug 31st, 2007 |
| Replies: 5 Views: 3,247 A handle is an opaque pointer (http://en.wikipedia.org/wiki/Opaque_pointer). |
Forum: C++ Aug 30th, 2007 |
| Replies: 5 Views: 880 I hope you're not surprised that intel's compiler has better optimizations because they _make_ the processors, and not because you just don't like microsoft. ;) |
Forum: C++ Aug 28th, 2007 |
| Replies: 22 Views: 2,282 How do you rotate a point? A point is a point, there's no kind of transformation you can do until you have more than one. :D |
Forum: C++ Aug 28th, 2007 |
| Replies: 9 Views: 990 Yeah, join_unsigned_int because signed values abort the program. It doesn't matter if the containing type is signed when you still don't allow signed values. ;)
Maybe a rule for negative... |
Forum: C++ Aug 28th, 2007 |
| Replies: 9 Views: 990 You might as well change the name from join to join_unsigned_int while you're at it. ;) |
Forum: C++ Aug 28th, 2007 |
| Replies: 7 Views: 982 Cool. Congratulations! :) |
Forum: C++ Aug 28th, 2007 |
| Replies: 5 Views: 749 In setiosflags(ios:fixed) you only used one : instead of two for name resolution. It should be setiosflags(ios::fixed). |
Forum: C++ Aug 28th, 2007 |
| Replies: 9 Views: 990 And without .net this works.
#include <sstream>
template <class T>
T Join( T a, T b ) {
std::stringstream ss;
T result;
ss<< a << b; |
Forum: C++ Aug 27th, 2007 |
| Replies: 0 Views: 3,846 A simple solution that prints the first n values in the fibonacci series up to the limit of an unsigned long. The program takes either command line arguments or interactive input for n and has code... |
Forum: C++ Aug 27th, 2007 |
| Replies: 16 Views: 5,797 I think the dev-cpp project is dead. If you use it then you won't get any updates or support unless you want to do it all yourself. Code::blocks (http://www.codeblocks.org/) is supposed to be the... |
Forum: C++ Aug 27th, 2007 |
| Replies: 15 Views: 1,414 Try using the number of values in the sequence to drive the loop. Say you want the first 10 fibonacci numbers.
unsigned long a = <a's initial value>;
unsigned long b = <b's initial value>;
for... |
Forum: C++ Aug 27th, 2007 |
| Replies: 16 Views: 5,797 http://www.turboexplorer.com/ |
Forum: C++ Aug 27th, 2007 |
| Replies: 16 Views: 5,797 Okay then, what are you doing exactly? |