We're a friendly, industry-focused discussion community of 1M+ developers and IT professionals learning and sharing knowledge. Ask us a question …

Member Avatar
Joined the Community
Member Avatar
Replied To a Post in 2D Array Help
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
Ok, will do, thanks #include <iostream> #include <cassert> using namespace std; class boolMatrix { public: static const int NUM_ROWS = 20; static const int NUM_COLS = 20; boolMatrix(); bool get(int row, int col) const; void set(int row, int col, bool value); int rowCount(int row) const; int colCount(int col) const; int …
Member Avatar
194 Replied To a Post in 2D Array Help
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
That code doesn't explain the weird printout. Post the whole updated program.
Member Avatar
Replied To a Post in 2D Array Help
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
It compiles and runs, it just doesnt output what its supposed to, its supposed to return the number of neighbors that have the value, true. I don't think its supposed to be all those numbers heres the code: int boolMatrix::neighborCount(int row, int col) const { int total = 0; int …
Member Avatar
Replied To a Post in 2D Array Help
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
Heres the output of what im running: 01234567890123456789 0 * ** 1 * 2 * 3 * * 4 * * 5 * ** * * 6 7 * * * 8 ** ** * 9 * * * 10 * ** 11 * 12 * ** 13 * * …
Member Avatar
194 Replied To a Post in 2D Array Help
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
>The get function is line 21 of the code I posted. OK, didn't see that. My point is that you aren't calling it. Line 14 has the brackets in it. > When I compile this all its returning is a bunch of jumbled numbers, garbage basically, If there's an error, …
Member Avatar
Replied To a Post in 2D Array Help
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
The get function is line 21 of the code I posted.
Member Avatar
Sponsored 104 Replied To a Post in Code Snippet Simple Example of a Genetic Algorithm
A while back I came across an article that mentioned genetic algorithms. For those unfamiliar with the term, simply put, rather than finding a solution to a problem by iterating over all possible cases, a genetic algorithm attempts to find a solution by starting with a guess, then generating a … Article by Reverend Jim in Programming
That's true. I didn't mean to crack down on your script or anything, it was just something I noticed. Dawkins is a classic. I can also strongly recommend *The Computational Beauty of Nature* by Gary Flake (ISBN 9780262062008). It's a good read, and relatively low on math, considering the topic. …
Member Avatar
194 Replied To a Post in 2D Array Help
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
> is this correct? You tell me. Does it give the right answers when you compile and run it with a bunch of different values, including when row is equal to 0? See prior post... int row_start = row - 1; if(row_start <= 0) row_start = 0; You used the …
Member Avatar
Replied To a Post in 2D Array Help
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
When I compile this all its returning is a bunch of jumbled numbers, garbage basically, can you refine what you wrote to me or something? Not making sense....
Member Avatar
Replied To a Post in 2D Array Help
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
Thanks, heres what I have when putting them all together, is this correct? int boolMatrix::neighborCount(int row, int col) const { int total = 0; int row_start = row - 1; int row_end = row + 1; int col_start = col - 1; int col_end = col + 1; for (int …
Member Avatar
Sponsored Donated to our Community; Thanks!
Member Avatar
194 Replied To a Post in 2D Array Help
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
You can use your totalCount function as a template, as far as a loop within a loop where the row and column changes. It'll be the same functions except... 1. The indexes won't range from 0 to NUM_COLS-1 or NUM_ROWS-1. They will range from max(0, row-1) to min(row+1, NUM_ROWS-1). Ditto …
Member Avatar
Replied To a Post in 2D Array Help
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
Ok thanks, got that taken care of, any idea the code I need for the neighborCount?
Member Avatar
194 Replied To a Post in 2D Array Help
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
You'll need to #include the cassert library. http://www.cplusplus.com/reference/cassert/ A valid row index will be 0 <= row < NUM_ROWS. So if a function is passed a parameter called row, you can stick this line at the top of the function: `assert(row >= 0 && row < NUM_ROWS);` For columns, substitute …
Member Avatar
Sponsored 1,442 Replied To a Post in Login Problems
I tried to go to a thread in Chrome and the connection timed out. I loaded Firefox and browsed to Daniweb and tried to log in. I was sent to Dazah (as expected) where I was told my password was no longer valid (I use a password manager so a … Article by Reverend Jim in DaniWeb Community Feedback
Try clearing your DaniWeb cookies. Does that fix the problem?
Member Avatar
Sponsored 1,183 Replied To a Post in Code Snippet Simple Example of a Genetic Algorithm
A while back I came across an article that mentioned genetic algorithms. For those unfamiliar with the term, simply put, rather than finding a solution to a problem by iterating over all possible cases, a genetic algorithm attempts to find a solution by starting with a guess, then generating a … Article by Reverend Jim in Programming
I'll add that change into my script. It's an obvious change in the event that no children are a better fit than the parent, however, to be fair, in real life evolution this would not be an option.
Member Avatar
Began Watching
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
Member Avatar
Stopped Watching
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development
Member Avatar
i have written 2 files. one is a PHP and the other one is Html (form file). i have echoed in PHP as follows: <? php $message = $_POST['stop here']; echo $message ; <? i want to send this message to an Html form file, as a text. i tired … Article by shlomo_1 in Web Development
Member Avatar
i have written 2 files. one is a PHP and the other one is Html (form file). i have echoed in PHP as follows: <? php $message = $_POST['stop here']; echo $message ; <? i want to send this message to an Html form file, as a text. i tired … Article by shlomo_1 in Web Development
Member Avatar
i have written 2 files. one is a PHP and the other one is Html (form file). i have echoed in PHP as follows: <? php $message = $_POST['stop here']; echo $message ; <? i want to send this message to an Html form file, as a text. i tired … First Post in Article by shlomo_1 in Web Development
Member Avatar
Joined the Community
Member Avatar
Sponsored 194 Replied To a Post in Women In Combat
OK, so I know an 18-year-old young woman who just graduated high school. She'd not related to me, but she's the daughter of a very close friend, I've watched her grow up, and I'm sort of an Honorary Uncle since she has no uncles who are blood relatives. She mostly … Article by AssertNull in Community Center
> So, in the name of equality, females should also be required by law to register with the SSS. It is unfair (sexist?!) to discriminate in this way. Things might become "fair" very soon. Not sure when the quote you linked was written, but a House Committee member (Duncan Hunter …
Member Avatar
Sponsored 104 Replied To a Post in Belated alert
I know I'm not the most regular user around, but I don't think I can make this in time. ![message.png](/attachments/large/2/f7c8649b77ab728b0c145056a64a4a83.png "align-center") Anyways, I love the changes, keep it up! Article by Traevel in DaniWeb Community Feedback
No that's why I was surprised to see it in my alerts. I think it has been 6 months. Had a little hickup logging back in with the new system, but all is good now. Edit: I think it was just the convo history and that the real alert was …
Member Avatar
Sponsored 1,442 Began Watching
I know I'm not the most regular user around, but I don't think I can make this in time. ![message.png](/attachments/large/2/f7c8649b77ab728b0c145056a64a4a83.png "align-center") Anyways, I love the changes, keep it up! Article by Traevel in DaniWeb Community Feedback
Member Avatar
Sponsored 1,442 Replied To a Post in Belated alert
I know I'm not the most regular user around, but I don't think I can make this in time. ![message.png](/attachments/large/2/f7c8649b77ab728b0c145056a64a4a83.png "align-center") Anyways, I love the changes, keep it up! Article by Traevel in DaniWeb Community Feedback
Haha has it b een that long since you logged in? :)
Member Avatar
Can somebody tell me how to increase page rank ? Article by ankitjaswal5044 in Digital Marketing
Member Avatar
Replied To a Post in How To Increase page rank ?
Can somebody tell me how to increase page rank ? Article by ankitjaswal5044 in Digital Marketing
Thanks for all the great tips
Member Avatar
I need help inserting the assert function within my code, and creating the neighborcount function as listed below, heres the guidelines: default constructor: initialize all of the array elements to false get: return the current contents of a single array element. Use arguments to indicate the row and column of … Article by Tom_15 in Software Development