15,300 Posted Topics
Re: [QUOTE=Robin_Dragon;447612]I found the solution to question i asked previously. But could someone please explain line by line what each line is doing. Thanx... [/QUOTE] Why? So that you can plagiarize someone else's code and turn it in as your own work? Why don't you add your own comments to work … | |
Re: >>why do we need that To complete the while statement. Normally putting a semicolon there would be a bug, but not in this case because there is nothing else to do. >>It's too compact to be readable. Then the reader doesn't know C language very well, probably a newbe. Looks … | |
Re: >>To do this, I somehow need to turn the int into a char of THAT INT, not the ascii character for that value. Do you mean if you have an int with the value 15 then you want a string "15" so that you can display it in an edit … | |
Re: I see its now been 8 days since you originally made this thread and thankfully still have surviced (not killed yourself) :) I assume that was just an exaggeration -- would you like me to change the title of this thread ? | |
Re: >>User will enter first name followed by one or more spaces and then the last name You can not do that with [inlinecode]cin >> fullname;[/inlinecode] because cin will stop reading from the keyboard at the first space, which is not what you want. User getline() to change that behavior, like … | |
Re: That's exactly why drivers should not eat while driving. At his age he needs to give up that crap anyway to avoid getting completly clogged artires and heart attack. | |
Re: The second problem I've seen occasionally too. Never attempted to mark forums as read so never experienced the first problem. | |
Re: create a new project then add the files to it. | |
Re: see [URL="http://msdn2.microsoft.com/en-us/library/ms686722.aspx"]this[/URL] There is no really good way to do it without some very serious side effects. | |
Re: [URL="http://www.robvanderwoude.com/errorlevel.html"]IF ERRORLEVEL[/URL] | |
Re: >>Provide for the "worst case in which all 20 numbers are different >>Use the smallest possible array to solve this problem. The answer is an array of 20. please post your pseudo code that you have written so far. | |
Re: It generates the same set of numbers every time because you didn't seed it. Do this: [code] #include <ctime> int main() { srand( time(0) ); // see the random number generator // other code here } [/code] | |
Re: you need to use an os-specific function to delay the program a bit inside the loop. If you are using MS-Windows you can include windows.h and call [b]Sleep[/b] function. >>cout<<"\010."<<flush; Thats poorly written. flush is not normally needed. Below is normally how to move the cursor back to the beginning … | |
Re: [QUOTE=Darrace;446701]wanna learn just cause it seems fun[/QUOTE] Its also illegal, so I'm closing this thread. | |
Re: Every character you can type on the keyboard is entered into your program as an int. The [b]char[/b] data type is really a one-byte integer. There is no such thing in C and C++ as a [b]character[/b] data type. So if the '@' character is causing your program problems then … | |
Re: Nice code you posted -- why did you post it ? (my crystle ball is broken tonight) | |
Re: Would you please also post [b]resource.h[/b] so that I can compile it ? | |
Re: what compiler are [b]we[/b] using ? And why are [b]we[/b] mixing C functions with c++ code? If you are going to write are c++ program then do so. Yea I know c++ language supports those c functions but its a lot better style to use all c++. | |
Re: Is is really all that hard to go 130 mph when riding down a mountain sloap; now do that riding UP hill and that would be a grand achievement. ? Certainly Mr. Stoeckl diserves all the glory and attention for doing it, but I would think it could be somewhat … | |
Re: First, don't allocate the buffers like that. Its just toooo much! If you want to use dynamic allocation then allocate them before the loop and delete them after the loop terminates. >>But I don't know how to move to the next item Increment the second parameter ?? | |
Re: I bought an Acer a few years ago from Best Buy because it seemed to be a good idea at the time -- no screws that is. After I got it home, opened the case to add another card, I had a terrible time trying to get it put back … | |
Re: ouch!!!! my butt hurts just looking at that. That sport looks like alot of fun, but .... | |
Re: why don't you replace the ifstream and ofstream objects with just one fstream object then open it for both input and output, in binary mode. | |
Re: how is [b]indata[/b] declared ? Is it a member of istream? | |
Re: This is a typical binary search algorithm. Before doing anything initialize the value of max to be 100 (because that's what you said would be the maximum possible value) and min to be 1 (for the same reason). You should delete lines 36 and 46 because those two are initialized … | |
Re: The [b]flush[/b] function forces data to be written to a disk data file (or some other output stream). There is a couple ways I can think of to solve your problem: 1. write each value to a file then read the values back and display them when the user is … | |
Re: >>I remember that the path a compiler uses to find a header file is determined by the "Path" that you see when you type "path" on the command line. Might depend on the compiler, but normally it looks in either the PATH environment variable or the path in the [b]-I[/b] … | |
Re: >>When the money is added it gets added to the begBal not the current balance In ProcessDeposit() why not simply add the transaction amount to the current balance? Change line 15 to this: [inlinecode]currentBal += transAmt;[/inlinecode] | |
Re: >>and i have a problem in writing the main If you really wrote the code you posted writing main() should be a breaze. So what is it about main() you can't (or won't) do ? | |
Re: [URL="http://www.google.com/search?hl=en&q=technical+colleges+in+california&btnG=Google+Search"]google[/URL] is a good place to start. Visit each college listed and see if they offer what you want. If you find some then visit them in person and talk to conselers. As long as they are accredited they should be ok. | |
Re: do you know how to code bubble sort? or any other sorting algorithm ? If yes, then sorting structures is nearly the same thing except instead of swapping integers you swap whole structures. But it runs a lot faster if you use an array of pointers to structures instead of … | |
Re: post the rest of that function becase what you posted is not enough to tell us anything about the problem you have. | |
Re: Minutes is calculated like this (I think). You have to subtract from original value of secs the number of seconds in hrs variable then mod the result with 60 (60 seconds in one minute). [code] secs -= (hours * sph); minutes = secs % 60; [/code] Now the remaining seconds … | |
Re: how about [b]exit(0);[/b] or [b]return 0;[/b] if called in main(). | |
Re: >>I just don't know how to find the sum of the numbers between 1 and the number they entered How would you do it yourself with pencil & paper? If I enter 5 then you want 1+2+3+4+5. Now do the same thing with a loop and two counters -- one … | |
Re: show us the code you have written so far. Do you know how to use [b]vector[/b] class? That is the easiest array to use. You can make a [b]vector[/b] of [b]string[/b] objects [code] std::vector<std::string> theArray; [/code] | |
Re: you must have changed something. post new code where the problem is. | |
Re: >>but I don't know where is the wrong? What does it not do correctly? I see a couple problems with line 17: 1. What happens if you enter a value for either [b]x[/b] or [b]y[/b] that are outside the range of the array? For instance, enter a value of 50000 … | |
Re: [URL="http://www.winprog.org/tutorial/"]Tutorial[/URL] [URL="http://www.daniweb.com/forums/thread70096.html"]Books[/URL] | |
Re: You can't reliably test for equality of floats due the the way they are represented in memory. May floats can't be represented exactly. So you can't reliably use the == operator. You might try something like this: [code] if( (newdeck > .449) && (newdeck <= .450) { // blabla } … | |
Re: >> run(v1, v2, v3, v4); you are attempting to pass the variables by values instead of by reference (pointer). Put an ampersand & in front of each variable to make them pointers like this [inlinecode] run(&v1, &v2, &v3, &v4);[/inlinecode] | |
Re: >>I posted the following in the stickied book thread as it seemed the most appropriate place for it. That was 2 days ago and no one responded so I probably guessed wrong Yes you were wrong to post it there so I deleted it just now because of this thread. … | |
Re: most win32 api functions have two versions -- one for char* and another for wchar_t*. If you are looking at a function that uses TCHAR* then you can just safely assume char* when not compiled for UNICODE. | |
Re: depends on the assembler, operating system and hardware in the target computer. If you are using a PC do you want the sound to come out of the sound card & speakers or out of the hardware sound speaker ? I have not attempted to do that but those are … | |
Re: >>Could any body else tell me what I should revise if I want to use pointers or reference for input? Nothing. Its already coded by reference because its not possible to pass an array any other way (pointers and references are essentially the same thing, although there are a couple … | |
Re: actually that isn't even compileable C function. It needs braces around lines 3-6. And the loop starting at line 10 has several problems -- one of them is probably infinite loop at line 12 because the value of j may never get incremented. It is also a horribly written function. … | |
Re: Opening a database is expensive in terms of both time and resources. So the fewer times you have to open it the better performace your program will achieve. I would opt for option #2. Of course one problem is that you may need to tell the database server to flush … |
The End.