6,741 Posted Topics
Re: >If I have two templates that are mutually dependent, is there a way to declare one without defining it? Yes, you can forward declare templates. | |
Re: >I can't get the compiler to accept the code So post the code. It's easier to figure out your problem when you give us more than just the bits and pieces that [b]you[/b] think are causing the problem. | |
Re: And the rest of the error is? Post your entire compiler output when you build the application. | |
Re: Okay, you have code that compiles, presumably you've also run it and seen that it does what you want. So why ask a question that you already know the answer to? Were we supposed to read your mind to discover what your real issue is? | |
Re: >I am a student taking up C programming Cool, sometimes it seems like new programmers are too afraid of C to learn it. >I do not know how to start with programming That's easy. Read books, do the exercises, ask questions on our C and C++ forum, and practice. >I … | |
Re: >From what I understand, there is not supposed to be any support for >string-datatypes in the language itself No, it just requires you to implement strings yourself using arrays of char. There's no need for an explicit string type because arrays of char do the job admirably. >the syntax gives … | |
Re: >but im not sure how to do that It would be easier to build the data part of a node in your client code and pass it to the binary tree class. That would involve something like this: [code] struct data { char arriveCity[30]; char departCity[30]; int totalPassengers; int passengers; … | |
Re: We have discussed this issue before, and it was determined that the impact is not sufficient to warrant the work of splitting the two languages into separate forums and making the main forum list longer. It's also more likely that Dani would choose to make C++ the main forum with … | |
Re: >if I remember correctly if the file to open isn't in the same directory as the file that contains the compiler Typically, the file will be relative to the current working directory, if you're in a command line environment. >This is an invalid expression. It looks fine to me. >Conditionals … | |
Re: >pls give me the code plss No, no, and no. We don't do homework, and the more you ask, the more we will consider banning you. If you want to post an honest attempt to solve the problem, we'll be glad to help you with it, but we won't do … | |
Re: >Anyone know of a hack to make this work in IE also? Use a background image with a different color for the navigation bar. Repeat it down the page, then set up your divs so that they fit nicely onto the image. The effect is a perfect navigation bar that … | |
Re: Structures are generally made global to begin with, that is, they are declared outside of all functions. | |
Re: [url=http://www.eternallyconfuzzled.com/tuts/random.html]This[/url] would be a good page to read, along with [url=http://www.eternallyconfuzzled.com/articles/rand.html]this[/url] one. That should cover all of the bases to help you solve your problem. :) | |
Re: >There is an error message which displays "warning: assignment to 'int' from 'double'". That's not an error, it's a warning. It's telling you that the fractional part of a floating-point value will be truncated when you assign it to an integer variable. You fix it by using doubles instead of … | |
Re: >Is there a (builtin) way to compare the contents of two stl maps? Have you tried the relational operators? Or did you just come running here before attempting anything so that you could waste time waiting for an answer? | |
Re: From a purely "ignorant user" standpoint, Firefox has some annoying browsing aspects that I've encountered. One of the most irritating is when going back or forward, the browser sends you to the top of the page rather than the place you were last like IE does. IE is comfortable, but … | |
Re: >is that dave sinkula? No, he's not nearly that cute. ;) | |
Re: The source base is the same, right? If you can keep an updated copy of the source at work then there's no point in using a cross-compiler. | |
Re: Just out of curiosity, where does it say that this forum provides help with proprietary libraries? | |
Re: >it tells me the 'p' is not declared identifier No, it tells you that P is not a declared identifier. Notice the difference in case and remember that C++ is case sensitive. | |
Re: >just wondering if theres any guidance you could offer as to learning MFC in c++ Don't? ;) >I get around 225 linker errors It sounds like you aren't linking with the correct libraries. Did you make any changes to your linker to allow building of MFC applications? | |
Re: I nominate this thread for the most cryptic question award. | |
Re: You can avoid nested if statements with the else if clause: [code] if ( sentence[i] == '0' ) cout<<"zero"; else if ( sentence[i] == '1' ) cout<<"one"; else if ( sentence[i] == '2' ) cout<<"two"; else if ( sentence[i] == '3' ) cout<<"three"; else if ( sentence[i] == '4' ) … | |
Re: >are all three correct possibilities to obtain the functions adres? You can only do two things with a function: call it, and take its address. If you're not calling it, then the compiler assumes you're taking its address. >I tried out the example you showed about pointers to functions and … | |
Re: >Here is the code if you can do it plz send me the coding You want to give us a simple console mode program and have us write a complicated GUI interface for it because you're too lazy to do it yourself? Are you having difficulty because nobody is stupid … | |
Re: A struct is just like a class in that it has to be terminated with a semicolon. And you need to declare an instance of the struct [b]after[/b] it is declared, not before: [code] #include<iostream> using namespace std; class linkedlist { private: struct llink { int elem; llink* nextelem; }; … | |
Re: >all of a sudden I found I've earned 11 reputation points... That's a good thing. It means you were helpful and the person you helped was kind enough to give you good rep. >how those points are summed up Each user has a reputation power based on their own reputation. … | |
Re: >I was just wondering what the term wildcard means in C++ It means nothing in C++. >why some people initalize int variables to -1 rather than 0 does this have any advantages? Not really, but it very much depends on the rest of the code. Can you give an example? | |
Re: >but trying to code it, it seems so complicated That's because it [b]is[/b] complicated. Sorry. | |
Re: >temp.size[i][j] size is an int, not an two dimensional array. Fix this, rinse, and repeat until your errors go away. Though just getting a clean compile doesn't mean it will work like you want it to. ;) | |
Re: >How would it change the code? First, you would start a new thread instead of resurrecting a thread that's over a year old. Then you would use a std::vector object because arrays are error prone and difficult to use correctly. Thread locked to avoid further bumping. | |
Re: The test for an illegal move relies on dice1 and dice2, yet, when there's an illegal move, you never reset those values, so the test will always fail. | |
Re: Do you need to actually draw it, or just plot the coordinates so that they can be imported into something like Excel? | |
Re: >which can help you out in learning the language C/C++ First, there is no language called C/C++. There's C, and there's C++, but no C/C++. Life is much easier when you don't confuse the two. Second, I wouldn't recommend any site for learning either C or C++ that has void … | |
Re: There should be a project option "Create DLL". That should be your first stop. | |
Re: >i don't understand the following clause. It initializes s to a null pointer. The cast is not needed, which suggests that the author really doesn't know what he's doing: [code] LargeStruct *s = 0; // Works just fine and is easier to read [/code] >why not just: LargeStruct * s? … | |
Re: These two member functions are not defined: [code] virtual void add(list<TelB*>&); virtual void del(list<TelB*>&); [/code] You need to either provide them with a body, or make them pure. | |
Re: >And a function that sorts from highest to lowest? That's a very broad question. You can look [url=http://www.eternallyconfuzzled.com/tuts/sorting.html]here[/url] for an idea of where you want to go with it. >How would I write a function that takes the highest number in an array of 10 and out put it? Conveniently … | |
Re: >it seems quite tricky getting hold of programming tips and tutorials which apply to c and not c++ Most of my tutorials favor C over C++ so that they can be more widely used and are easier to format for XHTML. You can also find active newsgroups (like comp.lang.c) on … | |
Re: >How important is it to learn and understand sorting algorithms and routines? It's very important. Even if you always use libraries (which is somewhat silly since libraries are designed to be generic and you may need something specific), sorting algorithms cover a huge number of techniques and concepts for designing, … | |
Re: Just clear the stream of extra characters. You can use this function: [code] void discard ( FILE *in ) { int c; while ( ( c = fgetc ( in ) ) != EOF && c != '\n' ) ; } [/code] | |
Re: >because of their ivory tower attitude towards software development As I like to say: Good developers look for solutions, good CS graduates look for problems. ;) | |
Re: >this is not the biggest dificulty in the world Judging from your code, apparently it is. >Hope it helps No, as a matter of fact, it doesn't. Your code is non-portable, and very poorly written. If giving the OP a freebie doesn't get him expelled, you'll have taught him bad … | |
Re: >i need my script to use all files in a directory You can search a directory with opendir and readdir and closedir. Check your man pages for details. >but now can i do this You need to build the path string manually: [code] char user_path[] = "user_path"; char filename[] = … | |
Re: Well, in the absence of a proper library, you can write a specialized conversion yourself without any trouble: [code] void wtos ( WORD w, PTCHAR s ) { s[2] = '\0'; s[1] = w % 10 + '0'; s[0] = w / 10 % 10 + '0'; } [/code] | |
Re: An array is just about the simplest and most useful thing you can think of. Imagine a line of boxes numbered 0 to N, where N is some arbitrary number. To put something in the fifth box, you walk over to the one with the number 4 (because they start … | |
Re: >#include <cstring> This doesn't give you the string class, it gives you the C-style string functions. Why not reverse the string in place? [code] int i = 0; int j = input.size() - 1; while ( i < j ) std::swap ( input[i++], input[j--] ); [/code] | |
Re: Um, code, please? | |
Re: Didn't you already ask this question? Weren't you already directed to a newsgroup that is more likely to care about your question than we are? | |
Re: One generally purchases books from a thing called "The Bookstore". There are even "bookstore"s online such as [url]www.amazon.com[/url]. |
The End.