Search Results

Showing results 1 to 40 of 139
Search took 0.13 seconds.
Search: Posts Made By: Hamrick ; Forum: C++ and child forums
Forum: C++ Sep 11th, 2007
Replies: 4
Views: 1,425
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
robgxxx, you're replying to threads that are three years old...
Forum: C++ Sep 7th, 2007
Replies: 2
Views: 729
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
If _you_ don't solve the question, what do you expect to learn? :(
Forum: C++ Sep 6th, 2007
Replies: 4
Views: 2,654
Posted By Hamrick
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
Posted By Hamrick
http://www.daniweb.com/forums/announcement8-2.html
Forum: C++ Sep 6th, 2007
Replies: 10
Views: 1,508
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
A handle is an opaque pointer (http://en.wikipedia.org/wiki/Opaque_pointer).
Forum: C++ Aug 30th, 2007
Replies: 5
Views: 880
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
Cool. Congratulations! :)
Forum: C++ Aug 28th, 2007
Replies: 5
Views: 749
Posted By Hamrick
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
Posted By Hamrick
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
Code Snippet: Fibonacci series
Views: 3,846
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
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
Posted By Hamrick
http://www.turboexplorer.com/
Forum: C++ Aug 27th, 2007
Replies: 16
Views: 5,797
Posted By Hamrick
Okay then, what are you doing exactly?
Showing results 1 to 40 of 139

 


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

©2003 - 2009 DaniWeb® LLC