Forum: C Oct 15th, 2009 |
| Replies: 3 Views: 408 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: 311 Look into the modulus (%) operator. |
Forum: C Aug 2nd, 2009 |
| Replies: 34 Views: 1,280 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: 742 NEVER use void main() (http://www.gidnetwork.com/b-66.html) |
Forum: C Jul 28th, 2009 |
| Replies: 3 Views: 376 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: 547 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 2nd, 2009 |
| Replies: 21 Views: 1,257 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: 468 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: 4 Views: 563 Your 1st half of the array array[x][0] is never initialized to zero so the values start out with garbage. |
Forum: C Jun 7th, 2009 |
| Replies: 18 Views: 877 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: C May 28th, 2009 |
| Replies: 13 Views: 1,031 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: C May 3rd, 2009 |
| Replies: 5 Views: 694 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: 694 Read the rest of the current line. |
Forum: C Apr 26th, 2009 |
| Replies: 6 Views: 1,632 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 25th, 2009 |
| Replies: 27 Views: 1,834 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 18th, 2009 |
| Replies: 27 Views: 1,834 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... |
Forum: C Mar 29th, 2009 |
| Replies: 7 Views: 577 What you are attempting to do can be done with arrays.
With audio as an array, you can reference audio[1], audio[2], etc. |
Forum: C Feb 11th, 2009 |
| Replies: 2 Views: 642 No. It would be fscanf(infile, "%s", arr[i]);
But, see this about scanf/fscanf (http://www.gidnetwork.com/b-62.html). It would be better to use fgets() instead. |
Forum: C Jan 27th, 2009 |
| Replies: 5 Views: 546 The problems I see in that function:
1) using getch() -- see this (http://www.gidnetwork.com/b-43.html).
2) recursively calling fnAddDepartment(); because an invalid department entered. Should... |
Forum: C Jan 8th, 2009 |
| Replies: 15 Views: 996 No, you don't want this. At least not in total.
First, %c reads a single character
Second, %s reads a string, but you don't want to use it. Here's why (http://www.gidnetwork.com/b-62.html)... |
Forum: C Jan 7th, 2009 |
| Replies: 15 Views: 996 Come come people. Look at the code. You can't read an integer using %c |
Forum: C Nov 24th, 2008 |
| Replies: 7 Views: 545 Not. Reread Salem's post, specifically
And to explain why he said "2) You're using gets(), the world's most dangerous function", read this (http://www.gidnetwork.com/b-56.html) |
Forum: C Nov 22nd, 2008 |
| Replies: 4 Views: 637 What he's getting at is variables should be defined only in code files, the .C or .CPP files. NEVER put a definition in a header file. Only the extern goes in the .H file.
The guards are only... |
Forum: C Nov 21st, 2008 |
| Replies: 23 Views: 3,286 Ahh, when someone points out why your advice is lacking, you go to personal attack. I've been soundly trounced! :icon_rolleyes: |
Forum: C Nov 20th, 2008 |
| Replies: 23 Views: 3,286 |
Forum: C Nov 16th, 2008 |
| Replies: 23 Views: 3,286 You've obviously never passed a programming course. |
Forum: C Nov 15th, 2008 |
| Replies: 23 Views: 3,286 If you'd try reading your post, you'd see that the question will never give you the proper answer. Your triangle does not give us the actual shape. Had you pressed PREVIEW you would have seen this.... |
Forum: C Nov 1st, 2008 |
| Replies: 9 Views: 840 strcpy(input," "); // You don't need to do this if your next
// line overwrites the value
scanf("%s",&input); // see this... |
Forum: C Oct 27th, 2008 |
| Replies: 22 Views: 1,850 All you need to do is set up a do-while loop and read the input inside the loop. |
Forum: C Oct 27th, 2008 |
| Replies: 22 Views: 1,850 You need to test the value after reading it. If invalid, start the loop. |
Forum: C Oct 26th, 2008 |
| Replies: 4 Views: 508 Did you call srand() only once? Or every time you called rand()? |
Forum: C Oct 19th, 2008 |
| Replies: 24 Views: 8,699 I have the same question as Salem -- why are you reading one character at a time? And if you are passing input into the function, why are you not loading it for the return?
Also, FYI, see this... |
Forum: C Oct 12th, 2008 |
| Replies: 6 Views: 736 Although the continue works in this situation, there are many times it won't work, so Aia's solution is better.
And what does fflush(NULL) do? |
Forum: C Oct 4th, 2008 |
| Replies: 8 Views: 2,136 There is a difference between a character array and a string. A character array
char a[3] = {'a', 'b', 'c'};
is not a string. Just because it happens to end in a '\0' when you don't define all... |
Forum: C Sep 18th, 2008 |
| Replies: 4 Views: 1,946 Absolutely the wrong way to flush the input buffer. See this (http://www.gidnetwork.com/b-57.html).
And also a terrible way to input a single character. Here's why... |
Forum: C Sep 14th, 2008 |
| Replies: 9 Views: 1,033 Why not write a short test program and find out. You have enough information to do that. |
Forum: C Sep 10th, 2008 |
| Replies: 9 Views: 1,033 Each function and arrow key is really two characters, a \0 followed by another character. Note the code:
KeyStroke = getch();
if (KeyStroke == 0)
{
KeyStroke = getch();
switch... |
Forum: C Apr 1st, 2008 |
| Replies: 5 Views: 1,174 Alt-PrtSc to copy the active window to the clipboard
Ctrl-V to paste it into Paint. |
Forum: C Mar 30th, 2008 |
| Replies: 12 Views: 1,963 My ghod! Go to the f'n links and download the FREE Turbo C Compilers I linked to!!!
Stop posting crap -- check your facts!
Maybe you can't, but it's obvious others have the knowledge to keep... |
Forum: C Mar 27th, 2008 |
| Replies: 12 Views: 1,963 Why would you even bother mentioning a piece of dreck like that? :icon_rolleyes: |