2,045 Posted Topics
Re: [QUOTE=frogboy77]It's like all "American" sports, more stop than start.[/QUOTE] Pray tell, what is the sport of your nation that puts the "American" sports to shame. ![]() | |
Re: Hint: is a space the only thing that can separate two words? Also, if the user hits enter, that's the second line. You're very close here. | |
Re: You shouldn't call main like that. Basically, you don't go back to the main() that you came from, you start a "new" main when you call it. I'm confused as to why you are needing to call main anyway if the function is going to return right after that. Also, … | |
Re: You have redeclared "smallest" and "largest" as ints in main(). There's no need to do that. | |
Re: Check line 36. I don't think it's the main problem, but it will catch up with you eventually. | |
Re: I took a course in Systems Analysis and Design eons ago and was taught something like the following: [url]http://en.wikipedia.org/wiki/Systems_Development_Life_Cycle[/url]. I'm not a practitioner, so I don't know what people actually do, but that method of analysis abstracts it a bit from compilation and testing cycles, so it may not be … | |
Re: Go through each element and keep track of the minimum and maximum values as you go. Also, add the element to a running sum and at the end divide by the number of elements. | |
Re: Line 9 (second listing) should not look like that. Are you trying to call the function? It looks like a definition. Also, formatting your code with proper indentation would make it easier to spot errors with the braces. Lines 88-100 on the first listing seem like they are floating outside … | |
Re: Use the "break;" that thelamb was suggesting. That will take you out of the j loop, but anything remaining within the i loop at the end will be executed. Then control will go back to the top of the i loop. There will be a fresh j loop at that … | |
Re: If your function definition is after main() you need a prototype for your function at the beginning. It belongs between lines 5 and 7. | |
Re: Look on your start menu and under the Qt folder (or wherever you installed it), there will be a Qt 4.whatever command prompt icon. Starting that will put all of the proper environment variables in place for that session. There's some specific compilation steps that you'll have to look up … | |
Re: What are the messages that the compiler is telling you? Learning how to interpret them is an important skill. Start with the first error. If you can't figure out what it means, post it with the line number. | |
Re: I'm confused. What values? Why don't you type it in and compile it? | |
Re: [quote=gerard4143]most computer languages use C as its interface to the outside world. [/quote] Not to steal some of the spotlight from the thread, but I'm confused by what you mean when you say this. Good points Adak. [quote]see the assembly output of the compiler or interpreter[/quote] The OP wasn't specific, … | |
Re: [code]cin.get(); /* i know this is soo wrong and bad but im just lazy in small test appls to use proper pause code here or to pipe output to a file */ [/code] This is actually one of the most portable and safest methods of pausing. Just wanted to comment … | |
Re: 5. Is this homework? ;) Why don't you write out what you think the answers are and someone will check them over for you. | |
Re: 27 has an extra semicolon that doesn't belong either. | |
Re: You've provided an excellent answer, vikashj, except that new and delete are not going to work in C. | |
Re: I've only skimmed through it in the past, but check out [url]http://www.freetechbooks.com/object-oriented-programming-with-ansi-c-t551.html[/url] (free and legal download). It does a lot of preprocessing on the code. Something you might be interested in, as I think it's at least peripherally related is the cfront system that converted C++ to C (see [url]http://en.wikipedia.org/wiki/Cfront[/url]) … | |
Re: At least 3 people already did: [url]http://www.daniweb.com/forums/post1336436.html#post1336436[/url] | |
Re: You can use the characters of stringValue1 directly (line 7 doesn't work, which you probably found out already). stringValue1[word] gives the proper character, and stringValue1.size() gives you the length. [quote]I just started C++ (new to programming) so I dont know all the functions.[/quote] Your professor knows that, which is why … | |
Re: I'm not sure how you'd do a direct conversion, but I'm assuming you're using their REST API. There's probably a call you can make to the server that when given the location, it'll send back the lat/long coordinates. | |
Re: Are you using Winforms or Win32? If Winforms, search on "GDI+ tiling an image" (some of the examples are for VB, but the syntax should be easy to translate to C++/CLI) Are you trying to display it or do you need to save a copy out like that? | |
Re: Take in your number as a string using fgets and check the string for good characters (characters from '0' to '9'). [quote]fflush(stdin); [/quote] Take a look at the links in [url]http://www.daniweb.com/code/snippet217396.html[/url] to see why that is not a good idea. | |
![]() | Re: [QUOTE=sharathg.satya]we can use spit()[/QUOTE] In what library? That's not in the Standard C library for sure. |
Re: Keep an array with the names of the months and search that instead of having that if/else block. | |
I recently was using the BinarySearch method and I was curious about why the designers had coded the method with the following for a return value: "Return Value The zero-based index of item in the sorted List, if item is found; otherwise, a negative number that is the bitwise complement … | |
Re: Test whether [icode] letter.length() == 1 [/icode] and while you're at it, check to make sure it's a valid letter using isalpha() from <cctype> (or your own version). Can you not change the signature of the function to take a char? | |
Re: A "node" doesn't have an empty() method (if it did, you'd have to access it as copyPtr->empty() anyway, because copyPtr is a pointer). Did you mean to pass in stacks instead of nodes? | |
Re: It's not just you, I've been having problems with navigating on the site tonight, too. There's a huge lag. | |
Re: It doesn't run for the first turn through. In general, if the condition on a for loop evaluates to false to begin with, the loop is skipped. In this case, after the for is skipped, x is incremented to 1, the next cycle of the while loop takes place, and … | |
Re: average is not an array. You can't take the i-th member of something that only has one value. What are you trying to accomplish with that line? | |
Re: You can use an iterator for what you are trying to describe (see the second post of [url]http://stackoverflow.com/questions/3221812/sum-of-elements-in-a-stdvector[/url]). Or you could use std::accumulate ([url]http://www.cplusplus.com/reference/std/numeric/accumulate/[/url] or the above link) | |
Re: Have a look at this [url]http://www.daniweb.com/forums/post155265-18.html[/url]. It tells you how to avoid that situation. | |
Re: dir is an uninitialized pointer, it's not pointing to any memory, so when you use gets (which you shouldn't regardless) you can enter characters until the cows come home and run right over whatever memory is adjacent to it. I would set up dir as a char array holding 256 … | |
Re: Do you want the user to be able to type 5 characters and no more, or is it a case where you can just take the first 5 off of what they type? | |
Re: Do your friends' computers have the Visual C++ Redistributables? (they come as part of the normal windows updates now, but they may have ignored them or removed them). If you have .dlls that go with your program, you have to make sure the other computer has them too. | |
Re: [quote]The function "getinput();" is a prototype function..[/quote] I've never heard the term used like that. What exactly does it imply? Also, what could be considered an opinion or design choice, but the do/while loop avoids the potential stack issues with the recursive function. | |
Re: In your loops where you are inputting the values, keep a running sum of the scores. Then outside of the loop divide by NUM_SCORES. | |
Re: Check out line 8 of your original posting, your prototype says that it takes 3 arguments. Something must be changed so the number of parameters matches up in your prototype (line 8), your definition(line 63), and your function call (line 22). | |
Re: Check out Emergent [url]http://grey.colorado.edu/emergent/index.php/Main_Page[/url]. It's got a bit of a learning curve, but in return for it you get a very powerful tool. I haven't used it recently, so I'm not sure how much help I could be with it. This one [url]http://www.justnn.com/[/url] is more straightforward. | |
Re: In your simple program, is it displaying the "Enter a number" prompt? Putting an "endl" after a cout statement puts in a newline and also flushes the output buffer. I believe you can simply put a "flush" if you don't want the newline. | |
Re: Go into C::B and open up Settings/Compiler and Debugger Settings and select GNU GCC Compiler at the top (assuming you load up C::B on your laptop with the default compiler). Select the Compiler Settings tab, and go down about 9 entries to "Have g++ follow the coming C++0x ISO C++ … | |
Re: Consider a smaller example: [code] 1000 0000 //0x80 as a mask Take the number: 0100 0110 //70 decimal & it with 1000 0000 = 0000 0000, first digit is 0 <shift bit of mask to the right> 0100 0000 & it with 0100 0110 = 0100 0000 => second digit … | |
Re: It's C++/CLI (used on the CLR in .NET) and it's certainly welcome here. | |
Re: Take a look at this: [url]http://www.cs.tut.fi/~jkorpela/forms/cgic.html[/url] Common Gateway Interface is the name for this sort of thing (Colby even calls it that on the websiste). That link goes into some of the technical aspects of it, but it seems if you can find hosting that will run CGI scripts then … | |
Re: It might help to know what you are trying to accomplish, unless this is just an exercise in theory. | |
Re: If you are concerned about the vcard you can get rid of it under control panel/Settings and Options(on the left)/Edit options [quote]I'd love to hear them tell that directly[/quote] If you hover over Ezzaral's panel on the left of his post, then you can see that he is a moderator. | |
Re: If your textbox is named textBox1, the textBox1->Text member contains the text that was typed in. Place a button on your form and double click it, and type your code in the button handler to display it in a message box or whatnot. | |
Re: Just select a "Win32 console project" to do "regular" C++. The alternative to .NET is using a "Win32 project," where you can use the Win32 API (see [url]http://www.winprog.org/tutorial/[/url] for an excellent intro to the subject). There's a steeper learning curve for the Win32API, but it brings you much closer to … |
The End.