Forum: C++ 6 Days Ago |
| Replies: 8 Views: 194 Display each grid you generate and see where the errors occur in the generations.
Are you taking into account that the edged of the grid only have 5 neighbors and not 8? |
Forum: C++ Oct 20th, 2009 |
| Replies: 4 Views: 376 Yes we can help you, but you must post code for us to help with. Read the Rules and the important sticky posts for info. |
Forum: C++ Oct 20th, 2009 |
| Replies: 9 Views: 337 Since you are using upperCase and lowerCase as character arrays rather than strings, you need to output each value individually.
If you want to use them as a string, you need to remember that as... |
Forum: C++ Oct 20th, 2009 |
| Replies: 10 Views: 332 Wouldn't it be helpful to us that aren't psychic to actually explain the problem? I assume you are having trouble compiling. |
Forum: C++ Oct 18th, 2009 |
| Replies: 3 Views: 222 Start by doing 1a which is very basic and quite simple. Then start adding the code for 1b. When you get stuck actually coding, we can help you overcome those problems. But you have to code... |
Forum: C++ Oct 18th, 2009 |
| Replies: 3 Views: 225 All you do is set valid to false at the beginning, never change it anywhere else in the code.
Think again -- what is the exit condition you need for the while and do-while loops. |
Forum: C++ Oct 18th, 2009 |
| Replies: 5 Views: 395 Sorry. I didn't see that code because it didn't make sense to me at the end, and in that form. It's best at the beginning of the loop in this case. |
Forum: C++ Oct 16th, 2009 |
| Replies: 5 Views: 395 It also never gets a new number. The line
guessNumber = rand() % 100 + 1;
Needs to be inside the loop. |
Forum: C++ Oct 15th, 2009 |
| Replies: 7 Views: 390 You need to use a loop and divide the number n by each odd number from 3 to n/2. If any number divides n evenly (no remainder) n is not prime. |
Forum: C++ Oct 14th, 2009 |
| Replies: 5 Views: 660 If you want to know how a program works, plzzzzzzzzzzzz post a program. Or try reading the Rules for the site. |
Forum: C++ Oct 14th, 2009 |
| Replies: 2 Views: 304 If you can't give us any more information than just posting almost 200 lines of uncommented code with no indication what's wrong, where it's wrong, and not using CODE tags, then there's no real help... |
Forum: C++ Oct 14th, 2009 |
| Replies: 3 Views: 184 First of all, format your code (http://www.gidnetwork.com/b-38.html) so it can be followed.
This code:
m = ~(arrX[I]);//convert to unsigned
m == m+1;
does not convert to unsigned. m == m+1; is a... |
Forum: C++ Oct 12th, 2009 |
| Replies: 1 Views: 188 Since doubles are rarely exact, probably your loop counter is wrong. For example when you think i=4 it's probably i=3.9999902 or something like that. |
Forum: C++ Oct 11th, 2009 |
| Replies: 3 Views: 296 The rename() function renames, does not copy. You need to open 2 files: the original file for reading, the new file for writing. Then read the old file and write to the new file. |
Forum: C++ Oct 4th, 2009 |
| Replies: 5 Views: 377 for(i=loc;i>=first;i--)
{
if(sorted_array[i] != key)
first=loc-1;
}
A while loop would be better here...
if(key=sorted_array[first]) |
Forum: C++ Oct 3rd, 2009 |
| Replies: 2 Views: 276 Yes, be consistent with your input. Always use getline() and you shouldn't have to worry about cin.ignore() |
Forum: C++ Aug 7th, 2009 |
| Replies: 4 Views: 364 Yes, but if set to spaces, pressing the TAB key can add 4 spaces which makes code much easier to read. And when posted here, where tabs are always screwy, helps us read your code. |
Forum: C++ Aug 2nd, 2009 |
| Replies: 5 Views: 307 If this is true, what does the statement
100 100;
do? (first statement)
What does
happy + 20;
do?
All I see are compiler errors. |
Forum: C++ Aug 2nd, 2009 |
| Replies: 11 Views: 512 Learn to Format your code (http://www.gidnetwork.com/b-38.html). That generally solves every bracket problem immediately. |
Forum: C++ Aug 1st, 2009 |
| Replies: 3 Views: 266 Since it's a text box, just look at every character in the box and remember the index of each 2 you come across. |
Forum: C++ Jul 29th, 2009 |
| Replies: 3 Views: 282 What statement causes the error? Do you really expect us to search through 200 lines of code we didn't write to find an error that is unknown?
Please give us enough details to help you. |
Forum: C++ Jul 28th, 2009 |
| Replies: 8 Views: 1,737 gurdeep kaur, how does your post help Lenny19 with his problem? Or do you have a new question which needs to be asked in it's own thread?
Before starting your thread, read some of the posts that... |
Forum: C++ Jul 28th, 2009 |
| Replies: 3 Views: 328 Has the book been released in ebook form? Did you search for it? |
Forum: C++ Jul 26th, 2009 |
| Replies: 3 Views: 322 Sure. I added the CODE TAGS you ignored, which are described
1) in the Rules (http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies) you were asked to read when you registered
2) in... |
Forum: C++ Jul 23rd, 2009 |
| Replies: 3 Views: 169 If usually starts with headers, then int main(). Then there's an input of some kind.
Then you get some if statements with some math intermixed, maybe even a loop or three, and finally some output... |
Forum: C++ Jul 21st, 2009 |
| Replies: 27 Views: 133,164 @guru_boy:
You didn't bother reading the thread before posting eh? |
Forum: C++ Jul 17th, 2009 |
| Replies: 3 Views: 763 There is no standard way to read characters like getch() |
Forum: C++ Jul 16th, 2009 |
| Replies: 9 Views: 359 Since we know the program you posted cannot possibly compile, and you claim it's actually running, you need to repost the current code you're compiling. And then explain in detail what the program... |
Forum: C++ Jul 14th, 2009 |
| Replies: 8 Views: 346 Another option is:
cout << "." << flush(); |
Forum: C++ Jul 11th, 2009 |
| Replies: 11 Views: 692 kbhit() is useful, but using getch() is also required. Understand what both functions do, and you should be able to figure out how to use them for your program. |
Forum: C++ Jul 2nd, 2009 |
| Replies: 13 Views: 533 Don't you also have to delete each p array? :icon_wink:
If you aren't sure, the answer is yes, delete each array first before deleting p itself. |
Forum: C++ Jun 29th, 2009 |
| Replies: 5 Views: 276 You're welcome.
Read the rules.
Including the use of u for you, no for know, etc. |
Forum: C++ Jun 29th, 2009 |
| Replies: 10 Views: 793 And are you still having problems? Are we supposed to use our psychic powers or would you like to explain fully what the problems are now? |
Forum: C++ Jun 27th, 2009 |
| Replies: 4 Views: 387 atoi() is portable
itoa() is not |
Forum: C++ Jun 24th, 2009 |
| Replies: 3 Views: 879 You probably blew past your buffer and started writing to memory you should not have written to. |
Forum: C++ Jun 24th, 2009 |
| Replies: 4 Views: 1,390 If the OP wants the value 49, this will work. I think the OP might want the value 1 so subtract 48 from val afterwards. But then again, he might mean something completely different.
Please... |
Forum: C++ Jun 24th, 2009 |
| Replies: 6 Views: 659 Write a function that searches the buffer. |
Forum: C++ Jun 24th, 2009 |
| Replies: 6 Views: 348 Smart decision. At least your teacher knows what the program is supposed to do and can ask the questions needed to help you. |
Forum: C++ Jun 24th, 2009 |
| Replies: 5 Views: 402 So is:
1) posting code the OP should be writing
2) posting code that is not formatted
Please do not post answers to questions. This forum is not a homework service. And that service should... |
Forum: C++ Jun 23rd, 2009 |
| Replies: 6 Views: 659 Binary files have binary information, not text information. Therefore, string functions probably will not be effective on the buffer. There are probably NULL characters in the binary data which... |