6,741 Posted Topics
Re: >I am elated, exhilarated, jubilant, overjoyed, ecstatic and happy! Well, congratulations. But keep in mind that it isn't how many posts you have, rather what you've done with your posts. For example, I respect Ancient Dragon far far more than, say, christina>you because his posts are focused on helping people … | |
Re: >I was just wondering if there was another way to out put text besides cout? You can use cerr, it's normally pointed to the same location as cout. You can also use the standard C output functions, but that can open an unexpected can of worms when it comes to … | |
Re: >I ended up having to re-route what I was trying to accomplish. What were you trying to accomplish? The way I'm reading your problem, you're confused about what [ICODE]this[/ICODE] is. A pointer to the current object is always available from a non-static member function; you don't have to pass it … | |
Re: >Anyone please let me know the main differences between TC++ and VC++? They're too numerous to list, especially considering the fact that Turbo C++ 3.0 is ancient and Visual C++ 2008 is state of the art. >how can i make a simple programme written in tc++ run in vc++ Post … | |
Re: [quote]I've just got a suspicion that my cloned version of XP Professional has never connected with the mother ship and may be trying desperately to phone home. (I actually own a purchased, registered version but wanted to try this one since it was very reasonable in price.)[/quote] Daniweb's rules specifically … | |
Re: >what is the difference between return 0 and return(0) ? Personal preference. Redundant parentheses are allowed, and the effect is the same. | |
Re: >i write viod main coz it saves me tym from writing return = o The return statement is optional in standard C++, so void main actually [I]costs[/I] you an extra keystroke. >so what actualli is the difference ????? void main isn't guaranteed to work, int main is. >whats the big … | |
Re: >mean tutor will acceppt Unlikely. I posted an implementation of itoa just this morning that may help you, search the forum and you'll find it. | |
Re: >many make a mistake of reporting something which they don't want to I haven't seen a statistically significant number of reports like this. The correct reports are the majority, followed by a small number of reports where the reporter confused the "Report Bad Post" link with the "Reply" button. >also … | |
Re: >But with this Windows operating system, there is absolutely NO WAY >that they make it easy to just poke away and start programming, like >I used to do with BASIC. If you keep comparing modern programming to what you used to do with BASIC, you'll likely not end up happy. … | |
Re: >It is sorta implied I write a program You can compile the implementation file without writing anything else. However, in some cases parts of a class won't be compiled (and thus won't throw errors if there's something wrong) unless you actually use them. So for a complete test you should … | |
Re: >am i understanding this correctly? So far, yes. | |
Re: Not without resorting to non-portable solutions. Just do what everyone else does and don't lose the size that was passed to the allocation function. | |
Re: There's a generate_n function in the <algorithm> header. | |
Re: If your definition of "help" equates to "do the work for me", no. Why don't you go off and try to come up with something on your own before you start begging for "help"? | |
Re: >Does the amount of comments written in the source code increase the size of the >final executed file or make the program any slower, even by a microsecond? No, comments are stripped from the source during compilation. | |
Re: You're not going to be editing the file directly. Instead use edit it in memory and then save back to the file. As for editing directly in the console window, you're SOL and need to get creative unless you use some non-standard form of controlling the console (such as pdcurses). | |
Re: >I have completed the basic concepts of C and C++. I doubt that. C is very nuanced, to the point where you could have years of both heavy reading and practical experience, and still be surprised. C++ is a beast, where the "basic concepts" are both broad and deep. Your … | |
Re: >i was trying to count the letters until i got to the space in between "Adam Sandler" and then >return that as FN (aka first name) and then make all char's after the space be LN (aka last >name). That's a reasonable solution. It looks like you're using a non-standard … | |
Re: >All loops are same in both the languages so why they are different for each other? Why is Perl different from C++? They both have a for loop with the same syntax. 1) Comparing the syntax of a single feature isn't a good way to compare languages. 2) C++ is … | |
Re: It's exactly the same: [code=cplusplus] List<List<String^>^>^ vec = gcnew List<List<String^>^>(); [/code] Don't forget to use gcnew for each of the sublists too, and feel free to simplify the syntax using typedef as has already been shown. | |
Re: >I think I could reduce my pointer headaches if only I could understand pointers better. If you're having trouble wrapping your head around pointers, chances are good that you're thinking too hard. Beginners tend to overcomplicate the concept of pointers into some massively difficult thing. >Somewhere in memory I've declared … | |
Re: The idea is to read what the << operator writes. In this case, your << operator writes a comma separated list of the values, all wrapped in brackets. So if you have the following matrix: [code] {0, 1, 2, 3}, {4, 5, 6, 7} [/code] The output would be "[0,1,2,3,4,5,6,7]". … | |
Re: >i know the output for the 1st case is wrong because it ends up showing in reverse You're extracting the digits from least significant to most significant, and printing in the same order. Of course it'll end up showing in reverse. You need to figure out a way to store … | |
Re: C++ doesn't support graphics natively. You need to determine which third party graphics library (SDL, Qt, Win32, etc...) you want to use, then your question can be answered. | |
Re: Sounds sketchy. What are you trying to accomplish with this program? | |
Re: >How do you find out if ThingType thing is in the list? Loop through all of the nodes and stop when you have a match. It's a basic linear search: [code=cplusplus] bool TheList::search ( ThingType thing ) { Node *it = listPtr; // Assuming your list is terminated with a … | |
Re: >fread() doesn't work on text files, I've experienced and then been told ;-) Whoever told you that is wrong. fread works fine on text streams. >suppose I use fseek, ftell, to get the filesize of a file, is that size+1 the correct >size for the buffer to read in the … | |
Re: strtok isn't that smart. It takes the delimiters you give and breaks up a string based on those delimiters, nothing more. If you want more advanced parsing, you're on your own. If you'd like advice, I'll be happy to help, but you need to be more specific about your needs. … | |
Re: The assignment wants you to start at x and add each number to a sum while counting up to y, like so: [code] sum = 0 while x < y do sum = sum + x x = x + 1 loop [/code] Compare that to your current code and … | |
Re: [quote=Sky Diploma] Well You can use the sort function to list and get the max value . For that you will need to write a bool comp() function for your datatype. Comparison function that, taking two values of the same type than those contained in the list object, returns true … | |
Re: Presumably by go managed .NET you mean use the String class instead of std::string. If so, the LastIndexOf method is what you're looking for. On a side note, do you even know that MSDN exists, or are you using the people on Daniweb as your personal programming reference? | |
Re: >How would I reuse functions in C? The easiest way is to create a header file with the declarations and link to a .c file with the definitions. Download one of the libraries [url=http://eternallyconfuzzled.com/jsw_home.aspx]here[/url] for a good example of that technique. Using Code::Blocks all you have to do is add … | |
Re: >I vaguely remember that there's a round() function in there somewhere. C99 added a bunch of stuff, including a round function. However, the signature doesn't match what the OP is talking about, so I'd guess it's a compiler extension. >i was wondering if someone knows what library it comes from … | |
Re: Please don't attach or link to code if it can be more easily embedded in your post. A 70 line program is short enough to fit, and it makes helping you easier. >didnt give me the accurate answer This is your problem: [code=cplusplus] final_grade=a+b+c/3; [/code] You want an average, which … | |
Re: >however, I want to do the other way around, copy >the values already in a vector into the array "current". That's completely opposite from everything else you've said thusfar. Allow me to summarize: You: "I want to assign a dynamic array to a vector." Us: "Here's how you do it." … | |
Re: Start by doing the in-memory parts and then you can add serialization to file once it working the way you want. This way you can incrementally add features and also be able to prove to us that you're actually working when you ask for help on the file I/O parts. … | |
Re: You forgot to ask a question. | |
Re: Use whichever makes more sense. In this case it's a counted loop, which is what the for loop syntax was designed to handle. | |
Re: >there is yet another problem for you... I've already solved that problem. Perhaps you meant to say "This is my homework". >Now we need a program that can choose the specified number of >words say n from this word in all possible ways and displays them As much as it … | |
Re: You run the counting loop for every iteration of the loop that searches for '$'. Try merging the two loops into one: [code=cplusplus] while (word != '%') { //... for (count = 1; word != '$' && count <= 7; count++) { //... } //... } [/code] | |
Re: >If yes, well, you could start with c++ I guess it's a good thing C++ was invented, otherwise all C programmers still would be at a loss of what to do after learning basic data structures. :icon_rolleyes: Do you really only think of C as a path to C++? | |
Re: Looks like an attempt at C++/CLI via C#. >am using vb 6.0 Um, is your code failing to compile? I'd imagine that it is. :icon_rolleyes: | |
Re: >What is that mysterious dark energy or matter surrounding us? A placeholder theory until we can explain the effects of the universe that brought about the theory. >Could it be the presence of God...? It could be anything, though the "presence of God" tends to be an explanation that halts … | |
Re: Generally when working with arrays like this, you should be taking two size parameters: one for the number of filled slots, and one for the capacity. That way if the array is full you can throw a proper error. So option #1 is to change the way your function is … | |
Re: >Is there no way that I can use gets() or scanf() in this? There's no way to use gets safely, but if your teacher is too ignorant or stubborn to recognize that, you really have no choice but to use it (keeping in mind that it's a very bad practice). … | |
Re: >This is my first post All the more reason to take care in following the rules. >and it is a reply to a old one Not anymore, I've done what you should have and started a new thread. >but if its any help to anyone it can be done quite … | |
Re: The remainder operator doesn't work with floating-point types. Look up the fmod function in <cmath> for getting the remainder of floating-point division. | |
Re: I've always been partial to table-based solutions, especially when the list of choices gets longer than about five. Excessively long if chains and switches are irritating to work with. For example: [code=cplusplus] #include <algorithm> #include <string> namespace { std::string face[] = { "A", "2", "3", "4", "5", "6", "7", "8", … | |
Re: >but godlike111 asked why? Actually, the OP asked "what". ;) But the "why" is because that's a specific constraint in the standard. The fundamental "why" is because pointers are maps to a location, not the location itself. Optimization concerns aside, there's no reason why a pointer couldn't be represented by … |
The End.