1,362 Posted Topics
Re: ifstream implies ios::in, so the ios::out should be ignored (have no effect) on the call to fopen. Why use binary mode, when you're just reading in characters? | |
Re: [QUOTE=StuXYZ;860537]Nothing, in the fact that it actually works, BUT it is a bubble sort and hence very inefficient. [/QUOTE] Nope, it's selection sort. Which is generally a bit more efficient than bubble. And as we discussed several days back, whether any of the n-squared sorts are really inefficient is a … | |
Re: Partition Magic is another good tool for this. $$ | |
Re: Welcome to DaniWeb You need to look up the getline( ) method. [icode] cin >> [/icode] will only read in one "word" worth at a time - it skips whitespace, grabs displayable characters, stops when it again encounters whitespace. Also, please use the code tags to make your code display … | |
Re: I'm curious about this input method [code] cin >>("%c", &letter); [/code] Looks like you're trying to mix C's scanf( ) method and the C++ cin>>. While it might seem to be working, in fact what it's doing is reading in and storing as if inputting to a char array, which … | |
Re: I think you guys are reading too much into the problem. It simply asks that the program keep track of the lightest and lowest values entered, there is nothing about storing all the values. sailorsun - once you've gotten the number of values to be examined from the user, use … | |
Re: Well, some mod you are! Don't you see the sticky thread at the top about books? :icon_razz: A good many of the first shown when you search Amazon look like good prospects, like #4 -[i] C++ for Dummies.[/i] #8 - [URL="http://www.amazon.com/Starting-Out-Control-Structures/dp/0321545885/ref=sr_1_8?ie=UTF8&s=books&qid=1240711853&sr=1-8"]Starting out with C++, Gaddis[/URL] is the one I use … | |
Re: Lines 3 & 4 - you create the array buf, then again allocate memory to it? Why using malloc() when you can use the C++ new? You're on the right track, as to return the string you need to allocate with new so the memory exists outside the function's stack … | |
Re: If I did my job as poorly as it seems the bank and auto execs are doing, that is, if 80+ students a term end up knowing less than when they started the term (which often isn't much), would I be getting a bonus and keeping my job? I think … | |
Re: Please use full words and full sentences to explain what your problem is. We don't do your work for you - read the notices at the top of the forum. When you post code, it's more readable (thus more likely to get a good response) if you use the code … | |
Re: Suspishio - Outlook is not tied to IE, Outlook Express is. Mickeybr - have you accepted the optional update in Windows for Root Certificate updates? Maybe something's changed in AOL's certificate signer? As to the Outlook data file - do you have a large store of messages? It might be … | |
Re: We don't do homework for free. We help you to fix and to understand the work you do. | |
Re: The problem says you will read up to 25 values, possibly fewer. A for loop to control the reading is not a good choice. Use a while loop that stops when you run out of data. Your second loop can be a for loop, assuming you kept count of how … | |
Re: On my system, this line [code] while ( (int)temp[i]!=13 && (flag==1)) [/code] keeps the program wanting data forever! Why are you comparing to integer value 13? Where do you get that magical number? Better to let the compiler figure out when you've reached the newline, in whatever encoding system is … | |
Re: All a config file need be is a simple text file with the values stored in it that your program will use. The program will open the file, read and heed the values. If the user wants to change those values through the program, then it will have to also … | |
Re: Please read the announcements and sticky threads at the top of this forum - there you'll see that we don't do your homework for you. Take a stab at it, post your code, ask questions about the problems you encounter, and we'll help you to find your solution. | |
Re: Why study XXXXX? Computing does not exist in a vacuum - we write programs to fill some need - a need related to biology, physics, chemistry, social sciences, weather, and so on. You need to have some knowledge of the domains in which you will support.. You will live and … | |
Re: Ask the question in the Hardware | Networking portion of DaniWeb? Geeks lounge is for entertainment and general conversation. | |
Re: I could say something about how when our current chief executive gets done, that's about all that will be left of a military band to play the song. But I won't. | |
Re: [QUOTE=nucleon;846882]Four bad sorts: bubble sort insertion sort selection sort shell sort[/QUOTE] I wouldn't call them "bad" sorts - it's all relative. In the days when processor speed was measured in MHz, sure, the first three would seem slow for data sets of any considerable size ( how big a problem … | |
Re: Strictly speaking, no. You don't have the #includes, no return statement, no closing curly brace. And the indenting (as displayed here) is not so great - goes in too far and too many levels. If you mean, will it display a certain number of pseudo random numbers,of some specified number … | |
Re: Do you really mean mixing managed and native code? Visual C++ is just a compiler, which compiles C++ code. Perhaps if you gave a full piece of code to illustrate the problem? There's not much we can do with just an error message and no context. Crystal balls don't have … | |
Re: When a cin >> is followed by getline( ), you will need to use the ignore( ) function in between. You normally don't need the ignore( ) between two input statements of the same type. | |
Re: Your second post looks like you're trying to do Bubble sort. You have the comparison and the exchange OK, it's the looping that's lacking. Look in your textbook, or do a quick internet search and you should find the basic algorithm for this. Post back what you do to improve … | |
Re: The main difference between semaphores and accessors/mutators is that semaphores are for signaling some state between threads, which might prohibit the use of accessor/mutator at a given moment in time. A Google search will turn up lots of good links that explain the thread control issue using semaphores, mutex, or … | |
Re: I don't know why you get that error, your function is calling itself correctly. Perhaps you're getting that error at the point where your originally call the function from your test program? One error, in the if clause, you need to use two | to represent OR, as in [icode] … | |
Re: I think the point of the assignment is not to create a copy of the string that is reversed, but to reverse the input string. Using a head and a tail pointer, swap the char that each point to, then advance each towards the middle. Be sure to stop when … | |
Re: Also this [icode] char gr = " "; [/icode] and all the similar statements assigning a string to the char variable, such as [icode] gr = "F"; [/icode] will cause errors, as you can't assign multiple characters to a single char. A string (that which is enclosed in double quotes) … | |
Re: Without the rest of the program, and a puzzle, it's kind of hard to find an error. Do your functions even get called correctly? Does the program crash or just end without (seeming to) solve the puzzle. Send stimulus check for new crystal ball batteries and we might be able … | |
Re: Simple solution - change your data type for the number of players to be a char - then the input will take it and your else clause will execute, then the loop goes round again. comments like this [code=c++] //the if statment that plays the game if the user choses … | |
Re: Showing some code would be helpful. I'm betting you're trying to assign to an array or structure, or trying to pass an array or structure to a function that takes an integer or...could be lots of things. | |
Re: Car and Driver Magazine's "article" on Obama ordering GM and Chrysler to halt participation in NASCAR. The story has been taken down, but you can (for a while, anyway) read it on the [URL="http://tinyurl.com/d5jrnq"]cached copy on Google[/URL] This has so many people up in arms! You can screw with our … | |
Re: RTFCM (Read the Full Compiler Messages) Pay attention to matching opening and closing { } | |
Re: Here's a couple links that should help you get started [url]http://www.dreamincode.net/code/snippet921.htm[/url] [url]http://msdn.microsoft.com/en-us/library/ms685035(VS.85).aspx[/url] | |
Re: How does the option chosen in the displayMenu( ) get to the processOption( ) function? For that matter, in displayMenu, your loop control keeps one seeing the menu and making a choice, as long as the choice is valid. Shoudn't that go the other way round? You need to work … | |
| |
Re: This [icode]for(int i = 0; i = numberofwords; i++)[/icode] is gonna cause problems - you continually set i to be numberofwords, not test i against it. Two strikes - you really need to use the less than operator, and if you did mean equality test, use two equal signs ( … | |
Re: [QUOTE=18jainabhishek;836540]plz solve this problem [/QUOTE] A - no one is likely to solve your problem for you. You must attempt the solution, show your work, and we'll help you get to the solution you need. B - don't ask a question by replying to an unrelated thread - that's hijacking … | |
Re: It's OK, AD - you probably heard it a million times before. If you click the "huh?" link, it will let you download the .wav file directly. | |
Re: But it does look like nice pseudocode, if you get rid of all the silly asterisks. Take what you've written ( or copied?) and translate that into C++ code. Declare and initialize the variables, start the loop, get data, check the input, process as needed. Keep looping. What's the "quit … | |
Re: Your Brain Usage Profile: Auditory : 58% Visual : 41% Left : 38% Right : 61% Same comments as The Dude received. | |
Re: NicAx64: What assurance is there that the OS will in fact write that new, random data to the same physical location on the drive? I think to do this, you have to get the OS to tell you what physical location(s) of the file is (cylinder, track, sector) and then … | |
Re: Also, writing in something approaching proper English is appreciated. Text- or leet-speak is generally not appreciated. | |
Re: You'll do it pretty much the same as with plain old int's. A search function must compare the comparable element from the book object with the target sought. So if you ask the user for an author, stored in a string, compare that to the string your getAuthor( ) method … | |
Re: Two questions. Is the file data in ascending order? What is that for loop inside the first if of your binary search supposed to be doing? If you found that array[middle] is the value you seek, return middle, right there and then. That for loop just spins around a lot, … | |
Re: What's got you stuck? You pretty much have the problem done. Your last loop is doing the wage calculations and storing them in the correct array. As I read the assignment, you shouldn't be doing output in that loop. As you have it, it's giving a heading that really should … | |
Re: IBM is/was more than a PC company. It did sell off its printers, then PC lines to Lenovo in China. But IBM is still Big Blue, doing more in the software and chips arenas. As to the Silicon Valley focus moving to the Far East, especially mainland China, there are … | |
Re: Or just open a command window and run the program from the command line. | |
Re: For this assignment, I'd assume all input in the file will be valid, that is, nothing that cannot be processed as a floating point value. That said, you could use the extraction operator ( >> ) to read from the file storing directly to a double rather than using getline( … |
The End.