Search Results

Showing results 1 to 40 of 156
Search took 0.01 seconds.
Search: Posts Made By: mrboolf ; Forum: C++ and child forums
Forum: C++ Jan 8th, 2009
Replies: 11
Views: 1,005
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,154
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,154
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,154
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: 990
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: 990
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: 990
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: 990
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: 794
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: 990
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: 990
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: 353
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: 322
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: C++ Dec 16th, 2008
Replies: 10
Views: 2,417
Posted By mrboolf
Here:



By the way no intention to flame - just a thought I liked to share.
Forum: C++ Dec 15th, 2008
Replies: 17
Views: 795
Posted By mrboolf
Yes but count == totalMonths :P
Forum: C++ Dec 15th, 2008
Replies: 17
Views: 795
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: 795
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: 795
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: 795
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: 795
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: 946
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,048
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,048
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: 433
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,048
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: 797
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: 316
Posted By mrboolf
Change a[i]= tmp; with a += tmp;.
Forum: C++ Dec 14th, 2008
Replies: 7
Views: 797
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: 502
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: C++ Dec 14th, 2008
Replies: 17
Views: 990
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,667
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: C++ Dec 12th, 2008
Replies: 5
Views: 924
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: 937
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: 603
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...
Forum: C++ Dec 11th, 2008
Replies: 17
Views: 990
Posted By mrboolf
Hi all there.

Given the huge amount of blackjack/card games threads and me being personally interested in poker and other games, I was feeling like starting to play with a few useful (at least I...
Forum: C++ Dec 11th, 2008
Replies: 10
Views: 890
Posted By mrboolf
From the link you posted:


That shouldn't be much difficult to implement, and



Give it a try and then post your efforts in case you need help.
Forum: C++ Dec 10th, 2008
Replies: 10
Views: 1,667
Posted By mrboolf
Thank you for just attached it.
I count to dedicate to the list implementation tomorrow - now I'm too tired (1 am here :P).

You're probably right suggesting me to slow down with iterators - I've...
Forum: C++ Dec 10th, 2008
Replies: 10
Views: 1,667
Posted By mrboolf
Sorry for replying so late guys but I was kinda busy.

Anyway, thanks VernonDozier for the interesting explanation of vector's push_back behaviour - now I can see the advantages of a linked list...
Forum: C++ Dec 8th, 2008
Replies: 10
Views: 1,667
Posted By mrboolf
Storing all the partitions is definitely a problem - as you can see from the Wikipedia page the value of p(n) increases really fast...
* p(1) = 1
* p(2) = 2
* p(3) = 3
* p(4) = 5...
Forum: C++ Dec 8th, 2008
Replies: 10
Views: 1,667
Posted By mrboolf
Thank you for the interesting reply.

I fear that you assumed a little too much about my actual skills - I'm just at the beginning of my 2nd year of a math degree and I know nothing about QM at the...
Showing results 1 to 40 of 156

 


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

©2003 - 2009 DaniWeb® LLC