2,045 Posted Topics
![]() | Re: Rather than getting it character by character, why don't you read the word into a std::string and capitalize that? Hint: std::strings are arrays and can have their chars changed one by one if necessary. |
Re: Why didn't you continue this thread?[url]http://www.daniweb.com/forums/thread294268.html[/url] | |
![]() | Re: Use the .is_open() method on lines 16 and 38 rather than fail. Fail is something different like for example if your stream is trying to read in doubles and it encounters a letter in the file (there are other situations that this arises in too). See [url]http://www.cplusplus.com/reference/iostream/ios/fail/[/url] Also, you could … ![]() |
Re: If the directory structure is the same in 7 as it is in Vista, probably in the c:\Users\<Username>\AppData folder. (But see [url]http://www.vistaheads.com/forums/microsoft-public-windows-vista-general/230161-whats-difference-between-appdata-local-appdata-roaming.html#post814489[/url] about whether it should be in the roaming or local subdir). I'm not sure of the way to get this information programmatically, though. | |
Re: You didn't take any of his advice except for inserting the include and the using statement. You need to change lines 11,20,27 to reflect string variables instead of the char array and the two char * values. You need to also change 13 and 47 to doubles. | |
Re: Why do you need a template at all? Can't your second member be a char to hold the operator? (or do you have more than '+','-', etc? | |
Re: I'm starting to believe you own something called the Daily Workbook of Inflammatory Issues and you're going through it page by page. | |
Re: [quote]For Example Suppose we have arr[10]= {2,4,7,3,7,8,1,7,3,1}; and file1 have elements 1,4,7,8,10 and File2 have elements 2,3,5,6,9. [/quote] Arrays have a starting index of 0, so you'd have to subtract 1 from these numbers to get the actual index. Read the numbers from your first file into an int array … | |
Re: Here are a few links: Specific to what you were looking for: [url]http://www.stevetrefethen.com/blog/UsingGoogleMapsforGeocodinginC.aspx[/url] Google's reference for geocoding [url]http://code.google.com/apis/maps/documentation/geocoding/[/url] How to get an account and use the RESTful services [url]http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_protocol.html[/url] I've used a similar API with Netflix but I haven't used the Google one in particular. Those links should get you … | |
Re: The code you have posted is not the same as the one you compiled. C++ is case sensitive for variable names so Std:: isn't std:: (you need the latter). Also, rather than being end1 (number one) its endl (letter l). Again, both of these seem to be correct in the … | |
Re: Law of cosines ([url]http://en.wikipedia.org/wiki/Law_of_cosines[/url]) will help you get the angles between all of them. I would test for the right triangle that way rather than your method (especially since your values a,b,and c are doubles and comparing those for equality is tricky (since a number close enough for practical purposes … | |
Re: Your function is designated to return [I]a single[/I] char and "pass" in passFunc is declared as a char array. There's a mismatch there. These errors don't include that you are trying to return a single character (perhaps thinking you are returning the char array) from your enterPass function that is … | |
Re: A couple of things to check: What is the definition of average? You do not have the formula correct. Secondly, if you have the numbers 1,3,4 (for example) will your average be an integer? What you are neglecting in your if/else cluster there is that you can test for more … | |
Re: A hint: moving forwards and backwards and comparing will not yield detection of a palindrome in the strings you have there. You have the right idea you just need some preprocessing first. Can [I]you[/I] think of any other efficient ways to do it? | |
Re: Are you looking in the debug subdirectory of the project? | |
Re: As long as they have all of the dlls that they need, you should just be able to run the exe provided you compiled it for their platform (so if you're on Windows and they are on Linux you'd need to compile a Linux binary). If you are using Visual … | |
Re: Another excellent reference is [url]http://www.parashift.com/c++-faq-lite/templates.html#faq-35.13[/url] (it has a ton of info on template classes too). | |
Re: What have you tried so far? | |
Re: Use [icode] str.str().c_str() [/icode] instead of [icode] str.str() [/icode] on line 26. You need the [iCODE]std::string[/iCODE] value represented as a C-style string ([iCODE]char *[/iCODE]) and the [iCODE]c_str()[/iCODE] method gets you that. | |
Re: You're mixing together two different things here. Lines 5-8 can only be used in C++/CLI code (C++ with .NET CLR) [url]http://en.wikipedia.org/wiki/C%2B%2B/CLI[/url]. See [url]http://stackoverflow.com/questions/236129/c-how-to-split-a-string[/url] for examples of how to do what you are describing. Here's a reference for the [iCODE]istringstream[/iCODE] they use in the first example [url]http://www.cplusplus.com/reference/iostream/istringstream/[/url] | |
Re: You have your opening brace before [icode] int main() [/icode] instead of after it Please start your own thread next time instead of bumping one that is almost 6 years old. | |
Re: [code] double test1, test2, test3, tes4, test5; string line1, line2, line3, line4, line5, line6, line7, line8, line9, line10; [/code] Look into arrays for these quantities. Also, when you have: [code] double& mean1, mean2, mean3, mean4, mean5 , mean6, mean7, mean8, mean9, mean10; char& grade1, grade2, grade3, grade4, grade5, grade6, grade7, … | |
Re: Change line 4 to: [code] string str = "ABCD"; P1.Inverte(str); [/code] | |
Re: Learn more. :) In a more concrete sense what I believe firstPerson was indicating (but I don't want to speak for him) was that you should look into using an array for the months so, [icode] int months[12]; [/icode] instead of all your separate variables and January would be [icode]months[0][/icode]. … | |
Re: Try changing line 1 on the first listing to [icode] public class puzzlepiece{ [/icode]. I believe .NET classes default to internal (meaning things in the same assembly can access it) but the compiler may not be content with that. | |
Re: See if something like this will work for you: (tags is a List<string>) [code] XmlReader xmlr = XmlReader.Create("Yourfilenamehere"); while (xmlr.Read()) { if (xmlr.NodeType == XmlNodeType.EndElement) tags.Add("/" + xmlr.Name); else tags.Add(xmlr.Name); } [/code] Then loop through and delete all the empty entries. After that use the string's replace method (I suppose … | |
Re: Excel can generate plain text files in CSV (comma separated values) format. You can use tabs or spaces also (though you must choose one of the three I believe). There are libraries out there that can give you more bells and whistles but you might not need that. | |
Re: You've probably omitted a semicolon after one of your class declarations in the header file. See if that fixes both errors, otherwise you can post back with your new error message. What does setupPlayerInfo belong with? Also lines 40 and 44 set up recursive calls to the function. This is … | |
Re: [QUOTE=dhruv_arora;1261211]Here's the correct code for the 2nd program [CODE] int num; cout<<"Please enter a number: "; cin>>num; for(int i=1;i<num;i=i+2) { cout <<" "<< num; } cout <<"end"; return 0; } [/CODE][/QUOTE] Please don't give away the answer if the OP is working towards it. Your code is also incorrect. Test … | |
Re: Where is [icode] getData() [/icode] defined (or declared for that matter). There may be a mismatch somewhere. [quote]Why do we have these unresolved externals?[/quote] Would you rather your program run without the appropriate functions? ;) | |
Re: What does the file contain? (text or binary) If it's text, look up StreamReader and read it directly into a string in one fell swoop with the ReadToEnd() method. If you use ToString() on an object that does not have an override for that method you get the class name … | |
Re: See [url]http://gmplib.org/[/url] (or use [URL="http://www.mpir.org/"]MPIR[/URL] for Visual C++ and mingw without cygwin) | |
Re: Why are you declaring your array as static? There's only going to be one copy over all the objects of your class. | |
Re: Use a stringstream: [code] #include<sstream> //... stringstream ss; string first = "AMBER/data/run"; string middle = "/amhsk_run"; string last = ".root"; ss<<first<<x<<middle<<x<<last; [/code] Use the [icode] ss.str() [/icode] to get the string back. | |
Re: [QUOTE=venkat arun] And to tackle the problem of getting the string size, you could get the string class to return the character array of the string, and then use strlen to find the length of the string[/QUOTE] Or use the [icode].length()[/icode] member of your string. | |
Re: You need something like this [url]http://pdcurses.sourceforge.net/[/url]. You may have to compile it but it says there are some binaries available. | |
Re: You don't need the .eof() loop, the getline will return null when it runs out of lines. In fact the .eof() can end up reading the last value twice (see [url]http://www.daniweb.com/forums/post155265-18.html[/url]). | |
| |
Re: You forgot to change [icode] radius [/icode] to [icode] radiusMain [/icode] on those 3 lines. Also, please use code tags [noparse][code]//code here[/code][/noparse] when posting your code to preserve formatting and make it easier to read. | |
Re: Make a class for a "player" and a "game" to go along with "room" (obviously you need many other classes but this gives a foundation). Have "game" instantiate an array of rooms and a player object. Try to go a bit further and come up with some code and we … | |
Re: It's called a "handle" which should make searching for info on it a little easier. Here is a good reference: [url]http://www.functionx.com/cppcli/handles/Lesson04d.htm[/url] It's basically just a designation that the pointer will be garbage collected (so the variable will be allocated in the "managed heap" -- C++/CLI has both a managed and … | |
Re: Please post what you have done so far. If you are missing the formulas a quick google should bring those up. | |
Re: No, this is not possible. You could have an array of size Nnamed entry and have entries 0 through N-1. | |
Re: Unmanaged arrays can't hold managed objects (and vice versa) due to garbage collection issues. If you are going to exchange data between the two it has to be marshaled. Your best bet is to have a class member that's a cli::array and initialize it in the constructor of your ref … | |
Re: Delete the timer from your form. Drag a new one from the toolbox onto the surface of the form, the icon for it should show up below your window in the designer in the gray box (you could just modify the existing code without adding and removing it but this … | |
Re: Line 17 is:[icode]for ([b]numbers >= 1[/b]; counter <= numbers; counter++) [/icode] The first slot in the for loop is used for initialization of the counter variable. What you have there is a conditional statement (like the one in the middle slot of the loop) that evaluates to true or false. … | |
![]() | Re: Definitely a spammer. |
Re: I'm not entirely clear on what you need done. If you want the last line you should probably use [icode] ios::end [/icode] instead of [icode] ios::cur [/icode] | |
Re: To get the Y value, [icode] int y = e->Location.Y;[/icode] Do you need to know the location and change the label simultaneously? I think it's much easier to handle the color change with a [icode] mouse_enter [/icode] and [icode] mouse_leave [/icode] event of the [I]label[/I] rather than the form. However, … | |
Re: Try merging linkedlist.cpp into linkedlist.h (see [url]http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12[/url]) queuelink.h seems to be in the right format. |
The End.