921 Posted Topics
Re: Rounding a number to the nearest whole number is one of the easiest things you can do in C++ :) there isn't even any need for an if/else statement, take this as an example. [CODE=CPLUSPLUS]float decimal = 3.4f; int rounded = int(decimal + 0.5f); // 3[/CODE] Hope this helps. | |
Re: I'm using it now, its good. Only a few things I have noticed: - Doesn't allow you to scroll by clicking the mouse wheel - Full screen flash applications run with a slightly slower FPS | |
Re: I have made a few mistakes when programming, probably one of my worst, and I still can't quite remember how I did it, but I flooded the desktop with about 10,000 empty files while making a program that splits one file into many smaller ones. ;) Deleting them was even … | |
Re: Some of this code is wrong, first of all, the class is missing a semicolon at the end, and you are returning a reference wrong. This is how it should be. [CODE]class ThreeD { int x, y, z; public: ThreeD() { x = y = z = 0; } ThreeD(int … | |
![]() | Re: How about using [B]std::valarray[/B]. [CODE=CPLUSPLUS]#include <iostream> #include <valarray> int main(int argc, char **argv) { std::valarray<std::string> arguments(argc); for (int i = 0; i < argc; ++i) arguments[i] = argv[i]; return 0; }[/CODE] |
Re: Its pretty much what it says it is, [B]IT Discussion Community for Developers & Technology Enthusiasts[/B]. :icon_neutral: If you have a problem, somebody can help you, or you can decide to help people. But there are a lot of forums here, so its hard to sum it all up into … | |
Re: >I like what your saying.... to be a good programmer we must love the program..!! To be a good programmer, you need to know how to make a program. | |
Re: Well, I would like to say i've become a fairly good programmer and im fully self-taught, but the really trick to it is [B]READING![/B], you will want to buy yourself a decent [URL="http://www.daniweb.com/forums/thread70096.html"]C++ book[/URL] if you want to learn anything fast. You also have to be willing to practice, and … | |
Re: Learn to post properly, firstly why are you bolding and highlighting every post in red, and secondly, use an appropriate thread name. [URL="http://www.catb.org/~esr/faqs/smart-questions.html#bespecific"]http://www.catb.org/~esr/faqs/smart-questions.html#bespecific[/URL] | |
Re: I tried it, and I found only one very small problem. [CODE]#include <iostream> using namespace std; const int N = 20; int main() { int a[N], i, nb, tmp; for (i = 0; i < N; i++) { cout << "Please enter an integer: "; cin >> a[i]; } do … | |
Re: Hmm, im not sure if this is exactly what you need, but perhaps you should take a look at [URL="http://msdn.microsoft.com/en-us/library/ms648055(VS.85).aspx"]WM_ERASEBKGND[/URL], it is this message which automatically erases your background when resizing or doing some sort of activity with your window, by doing this manually, you should be able to remove … | |
Re: Read this before posting.. see if you can figure out what you did wrong, all by yourself :icon_wink: [URL="http://www.daniweb.com/forums/thread78223.html"]http://www.daniweb.com/forums/thread78223.html[/URL] | |
Re: Would you mind giving some more information, perhaps show some code that may be causing the problem or an error message, we can't just "know" what the problem is :icon_cheesygrin: | |
Re: You just posted in a 4 year old thread, read [URL="http://www.daniweb.com/forums/thread78223.html"]THIS[/URL] before posting again, incase you missed it.. | |
Re: Nope, the preprocessor ONLY works before compile time, remember that, so you cant have a mix of the two :) edit: but maby you should look at the [B]typeid[/B] operator, it might be what you need for that example. | |
Re: >Please post in where you are having problems with your code [QUOTE=princess_19]I do not understand anything! I do not even know how to start!!! [/QUOTE] Im assuming she just wants it to be done for her with no effort what so ever. | |
Click [URL="http://www.dyson.co.uk/about/games/telescope.asp"]HERE[/URL]. Im up to level 23, currently stuck ;) Have fun :) | |
Re: So because you didn't find it funny you gave 4 people unnessasery negative reputation for disagreeing with you... sort of childish :D | |
A friend of mine just sent me this, I found it very funny! :icon_lol: [URL="http://newmedia.funnyjunk.com/pictures/learnchinese.jpg"]http://newmedia.funnyjunk.com/pictures/learnchinese.jpg[/URL] | |
Re: how about my first one :) From my hotmail account: [QUOTE]Marie SOLO Church Evangelique 7emeTranche Angré 26 rue 12 Abidjan Cote divoire Dearest brother, Please tell to your father to help me after you finish to read this message i know you have 15 years old. I know this mail … | |
Re: [QUOTE=Alex Edwards;685043]Then again I suppose it's not hard... [code=c++] const char *c_string = "c-string"; const char& refChar = c_string[0]; std::cout << &refChar << std::endl; [/code] ...though I'm not near a C or C++ compiler at the moment so I can't confirm if this will work or not @_@[/QUOTE] Or even … | |
Re: Making the executable small can be surprisingly easier than you think, make sure all your resources are fairly small, keep the code short and simple, and you can even download an executable compressor, which can make huge differences to the size. I use this one, it has never failed me … | |
Re: Theres also another common mistake that people make, which can easily cause memory leaks, consider this example:[CODE=CPLUSPLUS]int *varPtr = new int[1000]; // Allocate 1000 int's int intArray[] = {1, 2, 3, 4, 5}; // Make an array varPtr = intArray; // Assign varPtr with the adress of intArray[/CODE] In this … | |
![]() | Re: I dont quite understand your problem, I ran this test program and everything seemed to run ok. [CODE=CPLUSPLUS]#include <iostream> #include <string> using namespace std; void hello(string &str) { // Do something with str } int main () { string line; cout << "Welcome!" << endl; getline(cin, line); while (line != … ![]() |
Re: Thats not the mistake, the problem is that your trying to send keypresses to the window itself, not the text box inside it, you will have to get the handle to the text box in order for that to work. | |
Re: Please add code tags. **[CODE] Code Here [/CODE]** | |
Re: Why have you made two threads posting the exact same (badly presented) question.. its not going to make it get answered any quicker. | |
Re: Look at [URL="http://www.daniweb.com/forums/thread70096.html"]this[/URL] thread. [B]Manish_Singh[/B] just copied the first books its says on this thread. | |
Re: I started learning C++ (which is supposedly harder to learn than Java) at the age of 13, and im completely self taught. All it takes is a bit of time and effort, and it seems you just haven't put in the effort. :-O Theres also plenty of resources over the … | |
Re: Everything seems to work fine, although I don't particularly like the way you have formatted it (white space missed alot and its all very streched) but thats a matter of personal opinion. There were also a couple of compiler warnings to do with assigning [B]l1[/B] and [B]l2[/B] ([B]int[/B]'s) with [B]size_t[/B] … | |
Ahh, its soo confusing, I could only see her turning clockwise for about 10 minutes at first, then I could only see her going anti-clockwise.. which way do you see her turning :confused: ?? [URL="http://www.news.com.au/perthnow/story/0,21598,22492511-5005375,00.html"]http://www.news.com.au/perthnow/story/0,21598,22492511-5005375,00.html[/URL] | |
Re: Can you post some more code, like the definition of [B]soda_machine->dispenser[x][/B], if the code isn't very long, just post it all. | |
Re: "The spaces between your fingers were created so that another's could fill them in." | |
Re: Try looking at [URL="http://www.cplusplus.com/reference/stl/vector/"]vectors[/URL], it might be what your looking for. | |
Re: A way to do this would be to record every relevant message and the time between this message and the last message. To record it you could do something like this: [CODE=CPLUSPLUS] #include <iostream> #include <vector> #include <windows.h> using namespace std; struct Action { HWND hwnd; // Window Handle UINT … | |
Re: Essh the amount of times this question has popped up.. :icon_exclaim: | |
Re: Aperantly the actual number of the beast is [B]616[/B] not [B]666[/B] :) It said on [B]QI[/B]... they NEVER lie! | |
Re: Maby a good idea would be to make a dialog appear just before submitting thats says (in a very big font) "[B]USE CODE TAGS OR YOU WILL BE IGNORED OR YELLED AT!!![/B]" for newbies who have less than 3-4 posts ? Perhaps that will get to em. ;) | |
Re: Haven't you been to work experience yet ? When I went to work experience, We (me and another friend) ended up getting a placement at [URL="http://www.juicegames.com/html/home.html"]Juiced Games[/URL] for 2 weeks. That gave me a big experience of what programming can be like in a job. To be totally honest, it … | |
I have come across this problem a couple of times, if you reply to a thread, and then within a minute reply again, the order of the posts change like it has done for me in this thread. [URL="http://www.daniweb.com/forums/thread140791.html"]http://www.daniweb.com/forums/thread140791.html[/URL] I dont know if anyone else has ever experienced this problem. | |
Re: You can save the entire structure as binary, heres an exmaple of how to: [CODE=CPLUSPLUS] #include <iostream> #include <fstream> using namespace std; template<typename type> void SaveStruct(ofstream &out, type &obj) { out.write(reinterpret_cast<char*>( &obj ), sizeof type); } template<typename type> void LoadStruct(ifstream &in, type &targetObj) { in.read(reinterpret_cast<char*>( &targetObj ), sizeof type); } … | |
Re: You need to show at least a bit of effort, not just dump a question and expect us to solve it, you haven't even said what your problem is. What do you expect us to do ? | |
Re: [QUOTE=natpu;672024]Try to build SudoKu game. First try for 3 * 3 matrix. If you enter teo or three numbers in the block, it should automatically fill the rest of the fields. Really interesting.[/QUOTE] I managed to make this with a 9 x 9 matrix (in C++ though), its really hard … | |
Re: This isn't very related to the question, but [B]mahlerfive[/B], here is a few reasons why not to use [URL="http://www.gidnetwork.com/b-61.html"]system("pause")[/URL] . |
The End.