6,741 Posted Topics
Re: >But what I wanted was that even if user is in the middle of the program >when the user presses F1 it immediately restarts the program. What you want is an event, or a separate thread that polls for keypresses. Either way you'll be relying on even more nonportable features, … | |
Re: >Can´t Builder build and run my simple cpp old files? Builder has no problem with standard C++. Quite likely your "simple" C++ programs aren't conforming to the standard, and thus are only guaranteed to work on the compiler that they were written with. Post your code and the errors Builder … | |
Re: >It is C program. No, it's a C++ program. How do I know? Because GCC doesn't compile it and the error sounds very much like an out of order variable declaration, I seriously doubt you're compiling with the "-std=c99" switch that enables mixed declarations. Since it works on Windows, I … | |
Re: [url]http://www.catb.org/esr/faqs/smart-questions.html[/url] | |
Re: >i need help in inserting a particular string to a particular line in a text file.....is that possible It's possible, but not directly. You need to rewrite the file from beginning to end and insert your modified parts at the appropriate place. | |
Re: The C language doesn't know squat about graphics. You need to learn about the third party APIs (such as Qt, Win32, Allegro and SDL), choose which one you want to use based on the needs of your programs, and then learn how to use it. It goes without saying that … | |
Re: Ah, yet another mindless Microsoft hater who clearly isn't aware of the issues and thinks that calling Bill Gates evil will say everything that needs to be said. Blanket statements like that just serve to indicate your idiocy and lack of awareness. But to answer the request, I have nothing … | |
Re: You need to do some converting. Do some research on the std::hex stream manipulator for ideas. | |
Re: >when it leaves I want it to hold the words entirely not just the letters That's what it appears to do (after ArkM's fix, of course). I'd wager that you're not using the returned vector correctly. Can you post how you use example? | |
Re: >Your post is not going to get you answers Indeed. mus1010, it's generally wiser to show respect to the people kind enough to reply to you. Keep in mind that in replying, they're showing you a substantial measure of respect simply by not ignoring yet another "I don't know anything, … | |
Re: >I have difficulty to solve it What have you tried? Saying you've had "difficulty" is pretty vague. | |
Re: >So there's a size mismatch. And yet, the error doesn't say size mismatch, it says signed/unsigned mismatch. Your analysis is logical, but incorrect. >why is it stated signed/unsigned mismatch when all >variables are unsigned and no overflow is possible? Because this is a case where the integral promotions can bite … | |
Re: What you have looks good, except for a couple of nits: >printf("what is your age? "); >scanf("%d", &age); There's no guarantee that the prompt will be shown before scanf starts blocking for input. Which means that on some systems, all the user will see is a blinking cursor and they … | |
Re: Assuming you have control over glutMouseFunc, you need to overload it to accept a pointer to a member function: [code=cplusplus] class Plot { public: void MouseButton(); }; void glutMouseFunc ( void (Plot::*pmf)() ) { //... Plot p; (p.*pmf)(); //... } [/code] | |
Re: >What happens if Reg1 = 00000001 and Bit0 = 1 initially ?? What do [b]you[/b] think? Run through the same process and see what you can figure out. After all, it won't do for someone else to hold your hand through figuring out every combination of values you can think … | |
Re: It's pretty simple, really, kinda sorta. You have a base class with a virtual function, and a derived class that redefines the virtual function. By creating a reference to an object of the base class and initializing it with an object of the derived class, the virtual function will call … | |
Re: >Is there a reason not to use strtod( )? I can only think of one reason, but it's a doozy. strtod works in the wrong direction. The OP wants a conversion from float-point to string, not string to floating-point. | |
Re: It depends on the compiler. Both methods have been done, as well as translating from C++ to C, which is then compiled however the C compiler handles it. However, you'll find that most compilers have a switch that give you assembly output whether the compiler itself has a separate assembly … | |
Re: >DoDMA(); //allocate memory for the headers >BMPInfoHead = objCopy.BMPInfoHead; >BMPFileHead = objCopy.BMPFileHead; This strikes me as a memory leak. If DoDMA allocates memory to BMPInfoHead and BMPFileHead, you lose your only reference to the new memory by overwriting the addresses with this in objCopy. >I'm looking for a fast, preferably … | |
Re: >I was wandering if anyone knows any good hardware programming tutorials, or books in c++ I don't know about the quality, but I have seen them around. Searching google will give you the tutorials and communities, and a good computer bookstore should have at least one book on embedded programming. … | |
Re: Communication must not be your strong point. Why don't you post the requirements of your program instead of trying to summarize it in cryptic A-B talk. :icon_rolleyes: | |
Re: Assuming you mean final as applied to methods, the two are basically opposites due to default virtualness. In C++, member functions are not virtual by default, so the virtual keyword is used to enable virtual behavior. In Java, methods [I]are[/I] virtual by default, so the final keyword is used to … | |
Re: >char newname[] = ""; Good luck with that. Keep in mind that the absolute size of newname is 1, and be sure not to overflow the array. Don't forget to terminate your string with '\0'. ;) >strcpy (newname, the_date ); Oops, $10 says you overflow the array 100% of the … | |
Re: There are two problems. First, you can't provide a pointer to a template, it has to be a pointer to an instantiation of the template. Translation: provide the template arguments: [code=cplusplus] Array<int> var = apply ( m, &sum<int> ); [/code] The second problem is that there's a mismatch between the … | |
Re: So, essentially you want to return a pointer to ArmorArray. What's the problem? | |
Re: Seeing as how your posts follow the pattern of "Do it for me because I'm too special to learn", I've merged them into one thread so they can be more easily dismissed by the regulars. | |
Re: I use it regularly when I know the first hit is the page I want. | |
Re: >First of all, this: [ICODE]for(i=1; i<=100000000; i++){//its loop time [/ICODE] >is a horrible way to create a 'timer'. Yes indeed. It relies too heavily on the clock speed of the machine. For example, I have busy loops constructed like this that ran for exactly one second in the mid 1990s, … | |
Re: There's also a SelectionFont property: [code=cplusplus] this->richTextBox1->Select( 0, 10 ); Font^ current = this->richTextBox1->SelectionFont; this->richTextBox1->SelectionColor = Color::Red; this->richTextBox1->SelectionFont = gcnew Font ( current->FontFamily, current->Size, FontStyle::Bold ); [/code] | |
Re: >But if I use a array<int>, i don't want it to return >a array<int>, it should return a array<float>. Overloads can't differ only by return type. If you want an object of Array<float>, copy your Array<int> to it, then do the division. That's much easier and cleaner than the hoops … | |
Re: >cdArray[num_cds].print(out); cdArray is an array of char. cdArray[num_cds] is a char. char doesn't define any member functions. I'll let you figure out the rest of the errors, as they're the same thing. | |
Re: Take a close look at insertNode and tell me where you update head. | |
Re: Virtual functions are the backbone of runtime polymorphism. You can use a member function declared as virtual to redefine the behavior of a base class. Then, when accessing a derived class through a pointer or reference to the base class, the redefined member function will be called: [code=cplusplus] #include <iostream> … | |
Re: If you mean a complete reference of the standard library, I prefer [URL="http://www.dinkumware.com/manuals/"]Dinkumware[/URL]. If you mean all libraries under the sun (as some bozos come here expecting), it doesn't exist. | |
Re: >if(m==n) n is zero at this point, remember? Use a copy of n for your loop counter so that the original value is preserved. | |
Re: >invalid conversion from ‘const char*’ to ‘int’ Yep, that's what should happen. You say that Set should take a parameter of type T, where T is specified by the template class. If you pass a value that doesn't match the type of the template class and isn't compatible, you'll get … | |
Re: >Now, wouldnt you say it is embarrassing for a programmer having used linked >lists and pointers for about 1.5 years to have used "-->" instead of "->"??? When I've been writing C and C++ for well over a decade and still type mian instead of main over 60% of the … | |
Re: Since you're new here, I'll direct you to our [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]rules[/URL]. Specifically, discussion of how to write viruses is prohibited by Keep It Legal. As such, I'm also closing this thread. | |
Re: >This is checking you haven't done a self-assignment right? Yes, though that check is actually less effective than simply writing your code in such a way as to make it unnecessary. >Sorry what is sceleton slang for though? It's slang for skeleton, and I'm sure any dictionary will tell you … | |
![]() | Re: >How about using std::valarray. Why? That seems like a case of using valarray for the sake of using valarray. Kind of silly, in my opinion. |
Re: You can't get pseudocode wrong, just concentrate on the steps and outline them. For example: [code] read a test score is it less than 50? add a failing score otherwise add a passing score [/code] | |
Re: >I am just interested to know how many people here >have managed to become good by learning themselves. I'm largely self-taught. You can decide for yourself if I meet your definition [b]good[/b] or not. >Also would be interesting to know the general perception >of self-taught programmers by profesionals is? The … | |
Re: That's command line redirection, not arguments to the program. | |
Re: >but the second number can´t be same as the first one. That's not very random. :icon_rolleyes: Assuming you want the full range of rand minus the numbers already selected, you're pretty much stuck with re-selecting if you pick the same number: [code=cplusplus] #include <algorithm> #include <cstdlib> #include <iostream> #include <iterator> … | |
Re: >But are break and continue generally frowned upon because of that? Some people frown on break and continue because they don't see them as "pure" structured programming techniques. These people are generally too weak willed to use the best solution available or lack real-world experience where purity is, more often … | |
Re: >but it doesnt work the same because you have to press enter every single time. Be clear about your assignment first. Are you required to use raw input to achieve the correct behavior, or did you use getch because you personally think the result is better? This might be a … | |
Re: >who wrote the functions printf, scanf . You mean who "writes" the functions. Generally every new compiler re-implements printf and most or all of the standard library and the author of the compiler does it (or someone on the team if there's more than one programmer). >what is it's sourcr … | |
Re: Please use code tags and properly format your code. We'll give you a little leeway to learn how the forum works, but after a while (10 posts in general, but less if we feel you're intentionally refusing) you'll begin receiving infractions for breaking Daniweb's rules if you habitually fail to … |
The End.