Forum: C 25 Days Ago |
| Replies: 8 Views: 8,151 Umm you need a dynamic programming algorithm that uses subproblems and memoization to solve this adequately. Pretty sure all of the "solutions" listed in here are wrong. |
Forum: C 28 Days Ago |
| Replies: 9 Views: 412 no problem. If you want to go that route, I don't see how he could be upset. There are a lot of tutorials online on how to use structs. |
Forum: C 28 Days Ago |
| Replies: 9 Views: 412 Please don't PM daniweb members. Personally I don't mind, but in general, that is the rule here. If people want to help they will respond in your thread. Regarding your PM, if your professor... |
Forum: C 28 Days Ago |
| Replies: 9 Views: 412 My advice was to not use a 4 dimensional array when one is not needed. In fact my claim is that using a 4d array in this case is not good programming. If you were to declare a 2d array with this... |
Forum: C 28 Days Ago |
| Replies: 9 Views: 412 You should switch to using a struct to represent your ticket class, destination, seat, and time. . All four of those things are obviously related data. You're only going to cause yourself headache... |
Forum: C 29 Days Ago |
| Replies: 10 Views: 535 If an alternate approach helps at all: strstr in this case, since it returns "a pointer to the located string (or null ptr if it isn't found)" you can (hypothetically) read your entire file into an... |
Forum: C 31 Days Ago |
| Replies: 1 Views: 125 Considering that you just said you will be receiving a struct, as long as you know the format of the struct, you can use an array of structs to handle your message queue. This link describes how to... |
Forum: C 34 Days Ago |
| Replies: 7 Views: 236 Ahh. That explains a lot. Thanks a lot, you've been extremely helpful.
P.S. for everyone's amusement, I've spent the last half hour trying to figure out why I kept getting "connection refused"... |
Forum: C 34 Days Ago |
| Replies: 7 Views: 236 Yeah, I already did that on a whim, and thanks for compiling and helping me out - much appreciated. But what does "-ansi" actually mean? When I took C programming we just memorized to use that flag -... |
Forum: C 34 Days Ago |
| Replies: 7 Views: 236 What. . ?
I compiled with gcc -ansi -Wall client.c and I'm getting all sorts of errors. I'm not really sure what I could be doing wrong. I must be doing something really stupid though, because I... |
Forum: C 34 Days Ago |
| Replies: 7 Views: 236 Well, after reading Salem's response on another site (funny to run into Salem's post on another board from around two years ago, heh):
I'm not sure how to proceed, but it is interesting.... |
Forum: C 34 Days Ago |
| Replies: 7 Views: 236 After compiling the code found here (http://beej.us/guide/bgnet/output/html/multipage/clientserver.html#simpleclient), I immediately got a number of errors. (Unfortunately, Beej is the starting point... |
Forum: C Oct 26th, 2009 |
| Replies: 1 Views: 162 Nobody is going to do your homework for you. You will only receive help here if you show effort on your assignment. |
Forum: C Oct 22nd, 2009 |
| Replies: 4 Views: 246 No guarantees, but I read through this thread and it might shed some light. Of course, it is a C++ thread, but it is on the same exact topic (the OP there also claims the clock is always returning... |
Forum: C Oct 15th, 2009 |
| Replies: 3 Views: 295 To follow that with another question, if you remove the while statement, what happens if the amount of information you receive exceeds the buffer size? Even from the author's comments, it looks like... |
Forum: C Oct 14th, 2009 |
| Replies: 4 Views: 294 |
Forum: C Oct 14th, 2009 |
| Replies: 10 Views: 670 The main reason to use pass by reference is to be able to access the original object so that it will still be modified when you leave the function. Right? (Not the best wording, but hopefully what I... |
Forum: C Oct 12th, 2009 |
| Replies: 5 Views: 341 The switch statement just compares each case to whatever you are switching on, be it an int or a char. So I think there would be no tables, the assembly instructions would basically just subtract the... |
Forum: C Oct 12th, 2009 |
| Replies: 3 Views: 288 if ((col >= 19 && row < 16 & col >= 21 && row < 18 && col >= 25 && row < 22 && col < 27 && row < 12 && col < 29 && row >= 8) {
row < 16 & col >= 21 will not do what you think it will. You probably... |
Forum: C Sep 23rd, 2009 |
| Replies: 6 Views: 544 One thing I noticed right away is that your insertAtIndex function does not have a for loop. If you want to insert a node at the fifth index, then you will need a for loop and you will have to go to... |
Forum: C Aug 16th, 2009 |
| Replies: 22 Views: 1,076 "What I am not checking for is a character response."
You can look into ASCII character values; in order to make sure that something is an integer (or is not a character), you would compare the... |
Forum: C Jul 8th, 2009 |
| Replies: 13 Views: 792 I thought you marked my second post for bad rep, not the first, hence the confusion. But like I said, why is this such a big deal to you? Hmm. And I do "know C programming", I admit to not knowing it... |
Forum: C Jul 8th, 2009 |
| Replies: 13 Views: 792 Let's review:
I misread his question, then made a mistake. I then realized this mistake, admitted my mistake, and apologized to monkey king. I didn't whine for rep nor did I ask anyone for rep. I... |
Forum: C Jul 8th, 2009 |
| Replies: 13 Views: 792 Why would you give me bad reputation for admitting I made a mistake? That doesn't make very much sense. |
Forum: C Jul 7th, 2009 |
| Replies: 13 Views: 792 |
Forum: C Jul 6th, 2009 |
| Replies: 13 Views: 792 I don't know very much C programming but I am pretty good at google. http://www.elook.org/programming/c/strtok.html |
Forum: C Jun 30th, 2009 |
| Replies: 6 Views: 465 I actually don't understand the pattern. Enlighten me. |
Forum: C Jun 28th, 2009 |
| Replies: 8 Views: 322 I'd say your first problem is your inability to use code tags, leading to nobody caring enough to waste their time to read your code. |
Forum: C Jun 27th, 2009 |
| Replies: 5 Views: 367 http://www.cs.usfca.edu/~wolber/SoftwareDev/C/CStructs.htm
Use a Struct, put both of your linked lists in there. I forget how to make a linked list in C but I think all you need is two pointers,... |
Forum: C Jun 26th, 2009 |
| Replies: 36 Views: 1,305 What the poster above posted might look confusing, but what he is saying is a good way of doing this: Each String in the array will be the "name" of the index it is at. So index 0 of the array is... |
Forum: C Jun 24th, 2009 |
| Replies: 15 Views: 32,137 The most precise unit is as precise as you can get, so Rashakil's analogy does not make sense to me. You can get less precise, but not more precise. |
Forum: C Jun 19th, 2009 |
| Replies: 12 Views: 798 edit lol I realized I was wrong. |
Forum: C Jun 19th, 2009 |
| Replies: 21 Views: 1,105 The point Salem and others are making about the compiler seems to be two fold. One, that it is a piece of crap and coding with it is probably extremely frustrating. But secondly, and more... |
Forum: C Jun 19th, 2009 |
| Replies: 21 Views: 1,105 It might be placed correctly, but the syntax is definitely wrong. You said if (whatever); <----- the semicolon should not be there. An example if statement:
if (i > 0 && i <100){... |
Forum: C May 31st, 2009 |
| Replies: 5 Views: 511 And to clarify the '&' issue, if it wasn't already, the scanf function needs to know what the address of something is, and the '&' is the address of operator. Since the pointer already contains the... |
Forum: C May 27th, 2009 |
| Replies: 6 Views: 829 From what I remember, essentially, they both dynamically (while the program is running) allocate memory for your program, and the main difference is that calloc sets all the memory (that it allocates... |
Forum: C May 26th, 2009 |
| Replies: 11 Views: 553 gcc -ansi -Wall
w00t w00t. |
Forum: C May 14th, 2009 |
| Replies: 9 Views: 1,037 Agreed. There is also some order to which you need to malloc if I remember correctly. I don't remember the order though -- outermost dimensions [of an array] first? I'll look it up. |
Forum: C May 14th, 2009 |
| Replies: 9 Views: 1,037 42.
Also, I missed something here, because I was going to answer "You use the malloc function to dynamically allocate the array's memory. ." or something along those lines. Anyone care to clarify? |
Forum: C May 10th, 2009 |
| Replies: 8 Views: 492 I wish I had a banstick right now. |