Forum: C Jul 18th, 2006 |
| Replies: 9 Views: 1,186 >> I mean like the PYTHON , you can see a nice topic ( Starting Python) in this site , i mean like that .
A good tutorial is hard to write. It takes a lot of time, and the people who know enough to... |
Forum: C Jul 17th, 2006 |
| Replies: 2 Views: 2,994 >> which of the above methods is better in implementing .....
It depends.
>> what are the advantages of recursion over iterative methods ??... |
Forum: C Jul 14th, 2006 |
| Replies: 8 Views: 2,251 So you deliberately break the type system and then wonder why it doesn't work? :) What were you expecting to happen? |
Forum: C Jun 25th, 2005 |
| Replies: 5 Views: 2,024 > spans of whitespace?
Whitespace is when you hit the space bar on your keyboard, or the tab key, or the return key. Spans means one or more. So you're looking for one or more of ' ', '\t', '\n', or... |
Forum: C Jun 25th, 2005 |
| Replies: 5 Views: 2,024 To count the number of words, just count spans of whitespace. Each span of whitespace separates a word. To count the number of sentences, look for punctuation. |
Forum: C Jun 24th, 2005 |
| Replies: 10 Views: 2,338 > Which approach below is faster?
Generally, if you're working through a pointer, there's an extra level of indirection. Therefore, in theory, going indirectly though a pointer is slower. In... |
Forum: C Jun 22nd, 2005 |
| Replies: 3 Views: 17,585 > Is it right ??
No, you're thinking that the left side of my queues designate the front, which wasn't the intention. It works like this in the example that I gave:
New values go in here -> 1 2... |
Forum: C Jun 21st, 2005 |
| Replies: 3 Views: 17,585 Think of it this way: For each new value that's pushed onto the 'stack', you pop all of the values from queue1 onto queue2, then push the new value onto queue1. Taking a simple example, say you have... |
Forum: C Jun 20th, 2005 |
| Replies: 16 Views: 10,921 Start a new thread, dude. It's bad form to bring an old thread back from the dead. |
Forum: C Jun 19th, 2005 |
| Replies: 12 Views: 2,403 That's all well and good, but you didn't answer the original question. You just threw away the code given and posted a C-style solution with the implication that it was somehow better, without... |
Forum: C Jun 19th, 2005 |
| Replies: 12 Views: 2,403 > why is this more elegant?
C-style I/O doesn't recognize the std::string class, so you end up having to jump through error prone hoops to get it to work, or you need to use C-style strings, which... |
Forum: C Jun 13th, 2005 |
| Replies: 1 Views: 1,531 You seem confused about the difference between threads and processes. To use processes you fork a child from a parent and use one of several methods for inter-process communication. To use threads... |
Forum: C Jun 12th, 2005 |
| Replies: 3 Views: 1,545 You know we're not going to do it for you, right? |
Forum: C Jun 9th, 2005 |
| Replies: 4 Views: 1,417 >> So I guess to answer my own question, 'yes, I missed something'
Yes, but it's an easy mistake to make. Since string literals are of type const char *, and it's not possible to overload built-in... |
Forum: C Jun 8th, 2005 |
| Replies: 6 Views: 14,663 >> Temperary variable to be passed in recursive function
No.
>> temparary variable are temparary to scope of function
Yea.
>> and in recursive function we use global variable sort of things... |
Forum: C Jun 8th, 2005 |
| Replies: 6 Views: 14,663 You're on the right track. Try incorporating a temporary link into your function rather than trying to work just with head and its next links. |
Forum: C Jun 6th, 2005 |
| Replies: 2 Views: 1,102 I have no idea what your question is. Can you state it in a different way? |
Forum: C Jun 4th, 2005 |
| Replies: 3 Views: 2,905 Um, can you be more specific? It sounds like you want us to give you the full code for an FTP server for Linux, written in C. That's not a request that will ingratiate you to us. ;) |
Forum: C Jun 4th, 2005 |
| Replies: 5 Views: 2,670 I'm there regularly. Maybe you're just there are a slow time. :) |
Forum: C Jun 2nd, 2005 |
| Replies: 8 Views: 1,794 >Moron!
I'm not the one who came to a programming help forum asking other programmers to work for free.
>I came to this place for help and to learn obviously noone wants to help.
We don't offer... |
Forum: C Jun 2nd, 2005 |
| Replies: 8 Views: 1,794 This is a forum for programming help, not for hiring programmers. If you want someone to write this for you then you can get someone cheap at www.rentacoder.com. It's pretty clear that you have no... |
Forum: C Jun 2nd, 2005 |
| Replies: 2 Views: 1,258 No offense, though it will seem that way, but if you're incapable of even starting this then you probably haven't been paying attention in class. Why should we work to help you when all you seem to... |
Forum: C May 31st, 2005 |
| Replies: 11 Views: 2,411 PM me with the threads you're talking about and I'll see what I can do. |
Forum: C May 31st, 2005 |
| Replies: 11 Views: 2,411 >> My thought is that if they didn't want me to close it, they would have made the close function private or protected.
So you always use the open function too even though the constructor provides... |
Forum: C May 31st, 2005 |
| Replies: 11 Views: 2,411 I agree, but only if the fstream object doesn't go out of scope before opening another. There's no need to close the stream if this is your code:
int main(int argc, char **argv)
{
for (int i =... |
Forum: C May 31st, 2005 |
| Replies: 11 Views: 2,411 >> while ( ! file.eof() )
You shouldn't use <stream>.eof() as a loop condition. Because the eofbit is only set after a request for input has failed, you'll increment the counter once more than... |
Forum: C May 24th, 2005 |
| Replies: 4 Views: 3,790 A list of filenames is very different from an array of file contents. The former is very easy and becomes harder as you get lower level. A vector of strings is best:
#include <string>
#include... |
Forum: C May 24th, 2005 |
| Replies: 4 Views: 3,790 You have to be careful since .dsp and .dsw files are binary if I remember right. That limits you to a container of unsigned char and unformatted binary input:
std::vector<unsigned char> v;... |
Forum: C May 24th, 2005 |
| Replies: 2 Views: 6,692 You can omit the array size for the first dimension because array names are almost always converted to a pointer to the first element, so any size information is lost. That feature only applies to... |
Forum: C May 20th, 2005 |
| Replies: 2 Views: 3,503 Think recursively. Operands return the value, binary operators perform themselves on the left and right value:
if (is_operand())
return value;
T a = recurse(left);
T b = recurse(right);
... |
Forum: C May 20th, 2005 |
| Replies: 4 Views: 1,798 How does that function not work? There are a few iffy parts, like not checking fopen for success and not considering that fread can return a non-zero failure code, but there are no obvious errors... |
Forum: C May 18th, 2005 |
| Replies: 14 Views: 21,691 Here's the mathematical way to do it. But if this is homework, your teacher is probably looking for the brute force way of doing it. I won't show you that one because half the fun is figuring things... |
Forum: C May 18th, 2005 |
| Replies: 3 Views: 2,165 It depends on the compiler. Generally the files will be compiled in the order that they're listed when the compiler is run.
>>And what's the one declaration rule?
One "definition" rule. It means... |
Forum: C May 17th, 2005 |
| Replies: 3 Views: 2,165 One good reason would be to hide the implementation. If any changes need to be made to the implementation then it makes sense to separate it into a single file so that any code that uses the header... |
Forum: C May 17th, 2005 |
| Replies: 4 Views: 5,303 If you want to have multiple "worlds" then yea, that's probably the best way to go about it.
>>LOCATION *grid[MAX_GRID_X - 1][MAX_GRID_Y - 1];
Why are you taking 1 away from each of the sizes? It... |
Forum: C May 17th, 2005 |
| Replies: 1 Views: 1,209 Can you shrink down your code to something small enough to post? I don't think anyone wants to download your attachment, unzip it, create a collection of source files to match their environment's... |
Forum: C May 17th, 2005 |
| Replies: 5 Views: 2,347 >>if ( !isdigit( a ) || !isdigit( b ) )
isdigit takes a single int as its argument, and the int must be in the range of an unsigned char. Both a and b are being passed as pointers to char. Now,... |
Forum: C May 17th, 2005 |
| Replies: 4 Views: 5,303 You're basically just describing the "area of rooms" concept with different terminology. Both can be easily written using multidimensional arrays, or sparse matrices. In the file you could have the... |
Forum: C May 16th, 2005 |
| Replies: 16 Views: 51,778 I wasn't trying to solve your problem for you, sorry if I gave you that impression. I'm glad you figured it out without my help anyway. |
Forum: C May 16th, 2005 |
| Replies: 16 Views: 51,778 Not hairy at all. If integral division results in 0, don't show it:
#include <functional>
#include <iostream>
#include <string>
template <typename Pred>
void print_if(int part, Pred p,... |