Forum: C++ 1 Day Ago |
| Replies: 8 Views: 142 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: 9 Views: 332 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 15th, 2009 |
| Replies: 3 Views: 400 Let's see...
No CODE tags, even thought there are at least 6 places they are explained, and 3 of them on the main page alone.
No explanation about why code was posted
I guess all there is to say... |
Forum: C Oct 14th, 2009 |
| Replies: 4 Views: 290 Look into the modulus (%) operator. |
Forum: C++ Aug 2nd, 2009 |
| Replies: 11 Views: 494 Learn to Format your code (http://www.gidnetwork.com/b-38.html). That generally solves every bracket problem immediately. |
Forum: C Aug 2nd, 2009 |
| Replies: 34 Views: 1,253 weird is not an approved IT term. Be specific. Give details. What is the first question your mechanic would ask if you told him "my car is acting weird?" |
Forum: C Aug 1st, 2009 |
| Replies: 10 Views: 723 NEVER use void main() (http://www.gidnetwork.com/b-66.html) |
Forum: C Jul 28th, 2009 |
| Replies: 3 Views: 361 You have a ; you don't want at the end of the while statement:
while ((c = getchar())!=EOF);
if(islower(c)){
++letter[c-'a'];} |
Forum: C Jul 23rd, 2009 |
| Replies: 7 Views: 543 Code tags explained:
1) in the Rules (http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies) you were asked to read when you registered
2) in the text at the top of this forum
3) in... |
Forum: C++ Jul 17th, 2009 |
| Replies: 3 Views: 732 There is no standard way to read characters like getch() |
Forum: C++ Jul 14th, 2009 |
| Replies: 8 Views: 345 Another option is:
cout << "." << flush(); |
Forum: C++ Jul 2nd, 2009 |
| Replies: 13 Views: 529 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 Jul 2nd, 2009 |
| Replies: 21 Views: 1,206 Enough, people. The facts are
1) fixed code should not have been posted by anyone other than the OP
2) fixed code should not have been improved by anyone unless the OP posted correct code in the... |
Forum: C Jun 29th, 2009 |
| Replies: 7 Views: 451 you did much better than 95% of the new posters that can't be bothered to understand the forum before posting. :)
Simply output a newline after the six values - \n
Not sure what you mean --... |
Forum: C++ Jun 29th, 2009 |
| Replies: 10 Views: 776 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 29th, 2009 |
| Replies: 4 Views: 549 Your 1st half of the array array[x][0] is never initialized to zero so the values start out with garbage. |
Forum: C++ Jun 11th, 2009 |
| Replies: 23 Views: 1,199 Then stop replying posts you have no intention of of adding constructive responses to!
Adatapost, you do not have to use a jephthah-approved compiler. |
Forum: C Jun 7th, 2009 |
| Replies: 18 Views: 865 Load 19 random values. If a 0 is generated during these 19 values, remember that fact.
For the 20th value, if a 0 was not generated, load a 0, otherwise get one more random number. |
Forum: DaniWeb Community Feedback May 29th, 2009 |
| Replies: 17 Views: 1,487 So do I. For people like Jen0608 with 170+ posts, it's easy to make the required number of posts in one sitting to get to the sig limit. |
Forum: C May 28th, 2009 |
| Replies: 13 Views: 996 Consider this loop:
for (i = 0; i < 5000; i++)
{
sprintf(ifile, "file%04d.dat", i);
sprintf(ofile, "output%04d.dat", i);
//process the files
} |
Forum: DaniWeb Community Feedback May 16th, 2009 |
| Replies: 4 Views: 812 Actually, FC did not bump a really old thead. NetworkExpert did. He just tried to help out what he saw was a current thread. |
Forum: C++ May 16th, 2009 |
| Replies: 12 Views: 822 But you did get the CODE tags correct. The cplusplus part is optional.
Also, the PREVIEW button would show you if the tags are correct. |
Forum: DaniWeb Community Feedback May 9th, 2009 |
| Replies: 12 Views: 1,184 You don't care about the girls? :icon_smile: |
Forum: C++ May 7th, 2009 |
| Replies: 4 Views: 713 First thing you need to do is rethink the YEAR loop. Make it shorter. The leap year section in it makes the loop too complicated, and it's wrong. Don't deal with LY as a full year, it's one day.
... |
Forum: C++ May 7th, 2009 |
| Replies: 4 Views: 713 You didn't tell us the most important thing about your program. What is happening to make you think it's weird? |
Forum: C++ May 3rd, 2009 |
| Replies: 4 Views: 1,048 Agree with negative, disagree with base. Since it is a compiler-specific function, there is no 'official' definition. Therefore, adding base is simply a possible feature/addition. :icon_wink: |
Forum: C May 3rd, 2009 |
| Replies: 5 Views: 667 When you finish reading a line, you are automatically ready to read the next line. So just start reading again and there you are! |
Forum: C May 1st, 2009 |
| Replies: 5 Views: 667 Read the rest of the current line. |
Forum: DaniWeb Community Feedback Apr 27th, 2009 |
| Replies: 3 Views: 554 Green adds points to reputation.
Red subtracts.
Grey, no change to rep points. It's because the person that gives rep doesn't have enough posts that actually affect someone's rep. |
Forum: C Apr 26th, 2009 |
| Replies: 6 Views: 1,507 1: Zero your Total
2: Read the input as a string (hex)
3: Check each character and conve rt it into decimal value (A=10, B=11, etc)
4: Multiply Total by 16 and add the above value
5: Back to 2 |
Forum: C++ Apr 26th, 2009 |
| Replies: 25 Views: 1,729 Exactly! What I said about malloc() in my first post goes for new too. STOP USING IT! Reread what I said. |
Forum: C Apr 25th, 2009 |
| Replies: 27 Views: 1,798 Yes. See this (http://www.gidnetwork.com/b-62.html) and this (http://www.gidnetwork.com/b-56.html). Stop using gets()!
Then write C++ instead of C. If you want to write C code you must... |
Forum: C++ Apr 24th, 2009 |
| Replies: 25 Views: 1,729 OK, have a seat...
1) malloc() -- this will cause memory leaks on each call. Once the function returns, the memory address allocated is lost and can not be returned to the heap. Stick with the... |
Forum: C++ Apr 23rd, 2009 |
| Replies: 9 Views: 998 I don't understand... Is there a problem with ctime? |
Forum: C++ Apr 22nd, 2009 |
| Replies: 16 Views: 728 OK, fine. It's generally the last thing a professional programmer would do.
Peeking is generally used for OS level programming when you need to do things outside the ordinary. Reading the... |
Forum: C++ Apr 22nd, 2009 |
| Replies: 16 Views: 728 My ghod! Don't use cin.peek()! Read the line as text and process it. |
Forum: C++ Apr 22nd, 2009 |
| Replies: 9 Views: 998 Look at the header ctime. All the time functions are there. A Google search should give you definitions and explanations. |
Forum: C++ Apr 21st, 2009 |
| Replies: 16 Views: 728 What integer is '|'? That looks like a character so you cannot read it into an int variable.
To do what you need you'll have to read the input as characters. If you get a number, convert it to... |
Forum: C++ Apr 18th, 2009 |
| Replies: 11 Views: 659 You opened filein and you're reading from cin. |
Forum: C Apr 18th, 2009 |
| Replies: 27 Views: 1,798 If you don't know what index = 0; you seriously need to start reading your book before continuing. I suggest you talk to your instructor... |