Forum: C Nov 24th, 2007 |
| Replies: 58 Views: 4,913 r5ing:
A few things:
ยป Don't use scanf or it's non-standard variants for accepting user input. There are better ways of achieving it. Read this... |
Forum: C Jul 15th, 2007 |
| Replies: 6 Views: 966 Though I personally haven't used it, this (http://expat.sourceforge.net/) seems promising. |
Forum: C Jun 30th, 2007 |
| Replies: 9 Views: 1,621 Bobs, I would still recommend you to read some good tutorials on C or get some good C books from a store near you to do some reading. Without putting effort or learning on your part, explaining what... |
Forum: C Jun 29th, 2007 |
| Replies: 6 Views: 7,098 > I am very confused. How in the world are you going to implement a stack using function pointers?
I guess he means by using dynamic memory allocation, using a node structure which holds the data... |
Forum: C Jun 28th, 2007 |
| Replies: 9 Views: 1,621 Looking at your code, I can clearly see that you are desperately struggling with the language. Maybe you should try to get a firm grip over the langauge(or computer science concepts) rather than... |
Forum: C Jun 12th, 2007 |
| Replies: 23 Views: 13,608 No need of another buffer, a simple swap should do the trick.
int i, j;
char ch;
for(i = 0, j = nblocks - 1; i <= j; ++i, --j)
{
ch = iobuf[i];
iobuf[i] =... |
Forum: C Jun 11th, 2007 |
| Replies: 23 Views: 13,608 #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
size_t filesize;
size_t nblocks = 1;
FILE *in, *out;
/* check no. of arguments */ |
Forum: C Jun 11th, 2007 |
| Replies: 23 Views: 13,608 You are using the fread function incorrectly by swapping the position of the second and third parameter. The second parameter is not the size of the entire file, but the size of each chunk.
Try... |
Forum: C May 10th, 2007 |
| Replies: 27 Views: 3,808 Isn't this self explanatory? |
Forum: C May 8th, 2007 |
| Replies: 12 Views: 4,487 He didn't really mean it.
As far as program is concerned, read this (http://www.cplusplus.com/reference/clibrary/cstring/strtok.html), this... |
Forum: C May 7th, 2007 |
| Replies: 7 Views: 883 Print the entire array in main() after accepting user input and see if it is printing out any records, which it definitely should.
And why pass the variable 'i' when you can declare it as a local... |
Forum: C May 4th, 2007 |
| Replies: 12 Views: 2,315 Any reason for not using strlen ? :-) |
Forum: C May 4th, 2007 |
| Replies: 36 Views: 7,354 Using fgets for accepting input from user would do the trick. Read this (http://www.daniweb.com/tutorials/tutorial45806.html). |
Forum: C May 3rd, 2007 |
| Replies: 17 Views: 2,072 Next time try a more meaningful title. I edited the current one to make some sense out of it... |
Forum: C May 3rd, 2007 |
| Replies: 36 Views: 7,354 cin and cout don't belong to C language... |
Forum: C May 3rd, 2007 |
| Replies: 36 Views: 7,354 Read this (http://www.gidnetwork.com/b-59.html)and the related articles for a better understanding of scanf. |
Forum: C May 1st, 2007 |
| Replies: 2 Views: 714 Maybe this (http://www.acm.uiuc.edu/webmonkeys/book/c_guide/2.15.html) would help. |
Forum: C Apr 25th, 2007 |
| Replies: 2 Views: 797 Keep another variable outside the loop lets say grandTotal and at the end of each loop do something like grandTotal += loopTotal. Now this variable will hold the sum of all the totals. Don't forget... |
Forum: C Apr 21st, 2007 |
| Replies: 3 Views: 915 Explanation + Implementation (http://www.cplusplus.com/reference/algorithm/replace_copy_if.html) |
Forum: C Apr 13th, 2007 |
| Replies: 13 Views: 2,113 The point here is that, are floating point numbers absolutely necessary in your program. Can't your task be performed without floating point numbers? If you still want, you can safely pass integers... |
Forum: C Apr 13th, 2007 |
| Replies: 13 Views: 2,113 Stop using floating point variables as your for loop counter and you should be good to go. |
Forum: C Apr 8th, 2007 |
| Replies: 2 Views: 2,293 Full defination of prime number. (http://en.wikipedia.org/wiki/Prime_number) |
Forum: C Apr 7th, 2007 |
| Replies: 4 Views: 958 Keep a counter which will be initialized to 1, fgets the entire line of text in a character array, skip the first two lines using the counter previously mentioned and start reading from the third... |
Forum: C Apr 7th, 2007 |
| Replies: 10 Views: 5,735 I guess its payback time... :mrgreen:
I never said my code ensured proper distribution. Atleast it was logically correct. :D |
Forum: C Apr 7th, 2007 |
| Replies: 10 Views: 5,735 Not quite, its:
minimum + (rand() % (maximum - minimum));
This will produce random numbers in the range minimum inclusive and maximum exclusive.
;) |
Forum: C Apr 4th, 2007 |
| Replies: 9 Views: 2,219 or else Vista...
I have used that card and it performs fairly good when running Windows XP and even high end games. Like Joey said, its some Vista thing, no graphic card suckiness. |
Forum: C Apr 3rd, 2007 |
| Replies: 9 Views: 2,219 Yes, that can be a possibility.
Try doing Run -> dxdiag and run all the DirectX related tests. They will let you know whether your card supports DX10 or not. |
Forum: C Apr 3rd, 2007 |
| Replies: 9 Views: 2,219 Vista comes with DirectX 10.
Read this. (http://en.wikipedia.org/wiki/Windows_Vista) |
Forum: C Mar 19th, 2007 |
| Replies: 4 Views: 723 I still see a while loop in your code. On top of that the while loop uses the value of i which is 5 when the while block is entered (since you never reset it after the for loop).
Stop checking for... |
Forum: C Mar 19th, 2007 |
| Replies: 4 Views: 723 Some points:
1. Use code tags to post your indented code so that it is more readable.
2. The loop you use for input can easily cause buffer overflows if zero is not entered by the user. If you... |
Forum: C Mar 18th, 2007 |
| Replies: 8 Views: 4,648 Bumping your posts would do you no good. It would only result in a longer delay and is not encouraged. Patience wins the best help.
You just have to make sure that the element you have to remove... |
Forum: C Mar 17th, 2007 |
| Replies: 8 Views: 1,326 Arun, you need to properly format your code. Something like this:
void read_data()
{
int i,j,any;
char yesno;
char fname[15];
FILE *fp;
clrscr(); |
Forum: C Mar 14th, 2007 |
| Replies: 7 Views: 1,268 Assuming that the condition is "The loop should only be executed again (since its a do while loop) when the first is less than second AND the third is not equal to fourth OR when the number of... |
Forum: C Mar 9th, 2007 |
| Replies: 21 Views: 5,654 A simpler way would be to convert each and everything to intger and do away with the floating point confusion and havoc.
Penny - 0.01
Scaled Penny - 1 ( scaled by factor of 100 )
And in the... |
Forum: C Mar 8th, 2007 |
| Replies: 3 Views: 850 And if you really feel like learning them in depth, read this (http://www.daniweb.com/techtalkforums/thread50370.html)... |
Forum: C Mar 4th, 2007 |
| Replies: 27 Views: 3,939 You are getting an error because you are trying to print the "input stream" and not the "character array". In your use of fgets ( ) , "input" is the stream from which you are reading, line by line.
... |
Forum: C Mar 2nd, 2007 |
| Replies: 9 Views: 1,334 So atleast try out something you have in your mind and post it here. Help will automatically ensue.. |
Forum: C Feb 27th, 2007 |
| Replies: 22 Views: 4,229 Your problem area is:
strcpy (rstring, string);
rstring = (char*)malloc (sizeof (char) *strlen(string) + 1);
You need to first allocate the memory and then perform string copy and not... |
Forum: C Feb 26th, 2007 |
| Replies: 22 Views: 4,229 Its called casting (http://www.cplusplus.com/doc/tutorial/typecasting.html) . In this specific case its the casting of void pointer retuned by malloc to a pointer to a char.
A litte google would... |
Forum: C Feb 17th, 2007 |
| Replies: 17 Views: 22,960 |