Search Results

Showing results 1 to 40 of 182
Search took 0.02 seconds.
Search: Posts Made By: mrboolf
Forum: C++ Jan 8th, 2009
Replies: 11
Views: 992
Posted By mrboolf
Sounds like a subset generating problem to me.

I did almost the same thing a while ago, try reading this (http://www.daniweb.com/forums/thread159859.html).

Hope that helps.
Forum: C++ Dec 28th, 2008
Replies: 13
Views: 1,125
Posted By mrboolf
@VernonDozier: Yes, you're obviously right, I just wanted to make it as plain as possible for the OP :)
Forum: C++ Dec 28th, 2008
Replies: 13
Views: 1,125
Posted By mrboolf
I hope this is not homework, so I'll show you a little more (it's simpler than it seems!) #include <iostream>
#include <string>
using namespace std;

int char2int(char c) {
switch(c) {
...
Forum: C++ Dec 28th, 2008
Replies: 13
Views: 1,125
Posted By mrboolf
You could use atoi (http://www.cplusplus.com/reference/clibrary/cstdlib/atoi.html) or write your own char-to-digit converter, like this: int char2int(char c) {
switch(c) {
case '0':...
Forum: C++ Dec 24th, 2008
Replies: 17
Views: 970
Posted By mrboolf
Ok changes made :) next attachment (to appear after christmas I guess) will have them.

srand() call in deck::build was there because I used deck class directly before writing pokerGame class - now...
Forum: C++ Dec 24th, 2008
Replies: 17
Views: 970
Posted By mrboolf
Ok just a little upgrade:

some minor changes throughout the code and it now recognizes the hands as real poker hands.

testmain.cpp provides a little example of a 4-hand "match" (there's still...
Forum: C++ Dec 24th, 2008
Replies: 17
Views: 970
Posted By mrboolf
I see what you mean.

I was only worried to make it work so I forgot a couple of important things:

1 - At the beginning of the pokerGame::deal() function I had to clear all players' hands,...
Forum: C++ Dec 24th, 2008
Replies: 17
Views: 970
Posted By mrboolf
That's what it's supposed to do - shuffle the deck and deal different cards every time you run the program.
Forum: C++ Dec 23rd, 2008
Replies: 9
Views: 783
Posted By mrboolf
If a function returns, say, an int, you can use a call to that function in every place you could have used an int.
Examples:
#include <iostream>

int sumFunction(int a, int b) {
return a +...
Forum: C++ Dec 23rd, 2008
Replies: 17
Views: 970
Posted By mrboolf
You're great :) that was driving me mad.

Actually there was a double error, it shouldn't have entered the if because the line m_deck.build(); in pokerGame::deal() should have been...
Forum: C++ Dec 23rd, 2008
Replies: 17
Views: 970
Posted By mrboolf
Ok, 11 days have passed and though busy with many other things I brought this some steps further.

I restructured slightly the whole design - basically now all the classes are enough abstract to...
Forum: C++ Dec 21st, 2008
Replies: 4
Views: 346
Posted By mrboolf
Check out this (http://www.daniweb.com/forums/post755264.html), I hope it'll help :-)

It's still work in progress though there are some changes made...
Forum: C++ Dec 19th, 2008
Replies: 2
Views: 315
Posted By mrboolf
No.

We won't do your homework for you. Read the forum rules, post your attempt and then ask for help (specifically).

Make sure you use code tags.
Forum: Geeks' Lounge Dec 17th, 2008
Replies: 24
Views: 2,266
Posted By mrboolf
Well I think that I'll choose the name of my son/daughter (if any :P) because I like that particular name or after some person I really admire (a poet most likely).

There's nothing wrong naming...
Forum: Geeks' Lounge Dec 17th, 2008
Replies: 24
Views: 2,266
Posted By mrboolf
> Is it child abuse to name your son Adolf Hitler?
Definitely yes imo!
Forum: C++ Dec 16th, 2008
Replies: 10
Views: 2,384
Posted By mrboolf
Here:



By the way no intention to flame - just a thought I liked to share.
Forum: Geeks' Lounge Dec 16th, 2008
Replies: 3
Views: 453
Posted By mrboolf
Astonishing ignorance.

Thanks for posting, I'm waiting to read Chapter 2
Forum: C++ Dec 15th, 2008
Replies: 17
Views: 781
Posted By mrboolf
Yes but count == totalMonths :P
Forum: C++ Dec 15th, 2008
Replies: 17
Views: 781
Posted By mrboolf
You didn't tell it to do so, that's why it would not terminate the program.

if(choice=='Y') {
// do something
}
else {
return EXIT_FAILURE;
}

You should put your input validation...
Forum: C++ Dec 15th, 2008
Replies: 17
Views: 781
Posted By mrboolf
You want totaMonths to be the months that you entered data for? You don't need the variable, either use numYears*12 or declare month outside the loop and then use its last value.
Forum: C++ Dec 15th, 2008
Replies: 17
Views: 781
Posted By mrboolf
Well you cut off the endline - put it back or simply insert a space

cout << "Enter rainfall (in inches) for month " << (month%12) + 1 << " of year " << (month/12) + 1 << ": ";

Was it hard?
Forum: C++ Dec 15th, 2008
Replies: 17
Views: 781
Posted By mrboolf
I don't understand what do you mean - I put an endline before cin.

Post your code and explain where do you want to put the space (i.e. how is the output and how you'd like it to be)
Forum: C++ Dec 15th, 2008
Replies: 17
Views: 781
Posted By mrboolf
Either that or for(int month = 0; month < numYears*12; month++) {
std::cout << "Enter rainfall (in inches) for month " << (month%12) + 1 << " of year " << (month/12) + 1 << std::endl;
//...
Forum: C++ Dec 15th, 2008
Replies: 4
Views: 921
Posted By mrboolf
Read this (http://www.daniweb.com/forums/announcement8-2.html) closely.

No one is going to post-fed you a solution to your homework, so show some effort or prepare to be ignored.

After all it's...
Forum: C++ Dec 15th, 2008
Replies: 19
Views: 1,025
Posted By mrboolf
You may have fun looking into this (http://www.daniweb.com/forums/thread162304.html) and this (http://www.cplusplus.com/reference/string/string/string.html).
Forum: C++ Dec 15th, 2008
Replies: 19
Views: 1,025
Posted By mrboolf
#include <iostream>
#include <string>

using namespace std;

int main() {
string helloworld = "Hello world!\nHello world!\n"; // 2 times helloworld
helloworld.append(helloworld); // 4 times...
Forum: C++ Dec 15th, 2008
Replies: 3
Views: 429
Posted By mrboolf
Maybe this thread (http://www.daniweb.com/forums/thread161832.html) will help (it's still "work in progress" but may give you some ideas)
Hope this helps.
Forum: C++ Dec 15th, 2008
Replies: 19
Views: 1,025
Posted By mrboolf
1. Are you allowed to use recursion? If so it's easy.
2. Please use code tags (http://www.daniweb.com/forums/misc-explaincode.html) when posting code.
Forum: C++ Dec 14th, 2008
Replies: 7
Views: 791
Posted By mrboolf
What prevents your program from compiling is the following:

1) close doesn't need arguments - change both a.close("phonedir"); with a.close();.
2) else "" ; doesn't make sense. Maybe you wanted...
Forum: C++ Dec 14th, 2008
Replies: 2
Solved: string question
Views: 310
Posted By mrboolf
Change a[i]= tmp; with a += tmp;.
Forum: C++ Dec 14th, 2008
Replies: 7
Views: 791
Posted By mrboolf
getline(cin, line);
Shouldn't you take your line from the ifstream?

What daviddoria meant with the add function is that you are every time rewriting the file instead of just adding lines.
...
Forum: C++ Dec 14th, 2008
Replies: 8
Views: 494
Posted By mrboolf
I you would like to keep track of previous executions of your program I suggest you to write these informations in a file - you can't keep an array from one execution to another afaik Oo
Forum: Geeks' Lounge Dec 14th, 2008
Replies: 0
Views: 625
Posted By mrboolf
castpuzzle.net (http://www.castpuzzle.net/english/index.html) My brother just brought me one from Munchen and I went crazy about it :P

This is mine: Cast Radix...
Forum: Geeks' Lounge Dec 14th, 2008
Replies: 5
Views: 587
Posted By mrboolf
Movies version (http://www.youtube.com/watch?v=vEc4YWICeXk&feature=related).

I like these things :D
Forum: C++ Dec 14th, 2008
Replies: 17
Views: 970
Posted By mrboolf
Sounds good to me, I'll make that change :-) Thank you.

@VernonDozier: Thank you too for the advices.
My short-term goal would be to make a Poker game - not that I'd like to play it more than...
Forum: C++ Dec 14th, 2008
Replies: 10
Views: 1,629
Posted By mrboolf
Ok sorry for the delay.

I couldn't come up with a decent thought on how to effectively use the structure of linked lists to my advantage - I basically rewrote my first shot using a list of vectors...
Forum: Geeks' Lounge Dec 12th, 2008
Replies: 5
Views: 587
Posted By mrboolf
Forum: C++ Dec 12th, 2008
Replies: 5
Views: 895
Posted By mrboolf
State_Tax is expecting float, you are passing float*.
Change *statetax = State_Tax(federaltax); to *statetax = State_Tax(*federaltax);
Forum: C++ Dec 12th, 2008
Replies: 11
Views: 929
Posted By mrboolf
string myFile("rawDictionary2");
int totalWords= wordCount(myFile);
you are sending in a string, why do you want it to accept an ifstream?
Forum: C++ Dec 12th, 2008
Replies: 11
Views: 596
Posted By mrboolf
Also: why do you check i?
Instead of if(i=='m' && 'male') try if(s=="m" || s=="male").

First correct your toLowerCase as AncientDragon suggested, then fix "minor" things like the one I pointed...
Showing results 1 to 40 of 182

 


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

©2003 - 2009 DaniWeb® LLC