2,045 Posted Topics

Member Avatar for Brian Perrigan

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.

Member Avatar for jonsca
0
62
Member Avatar for c++learner

Why didn't you continue this thread?[url]http://www.daniweb.com/forums/thread294268.html[/url]

Member Avatar for c++learner
0
154
Member Avatar for Griff0527

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 …

Member Avatar for Griff0527
0
258
Member Avatar for CppBuilder2006

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.

Member Avatar for jonsca
0
100
Member Avatar for deez2183

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.

Member Avatar for jonsca
0
255
Member Avatar for kaydee123
Re: HELP

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?

Member Avatar for jonsca
-1
126
Member Avatar for cwarn23

I'm starting to believe you own something called the Daily Workbook of Inflammatory Issues and you're going through it page by page.

Member Avatar for GrimJack
1
453
Member Avatar for Rocky111

[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 …

Member Avatar for Rocky111
0
90
Member Avatar for paeez

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 …

Member Avatar for jonsca
0
109
Member Avatar for Wakesta

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 …

Member Avatar for Wakesta
0
186
Member Avatar for johnb08

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 …

Member Avatar for johnb08
0
106
Member Avatar for dhruv_arora

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 …

Member Avatar for nbaztec
0
163
Member Avatar for csha_cs508

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 …

Member Avatar for csha_cs508
0
185
Member Avatar for sankaran1984

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?

Member Avatar for jonsca
0
102
Member Avatar for dhruv_arora
Member Avatar for p@rse
0
133
Member Avatar for pinsickle

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 …

Member Avatar for pinsickle
0
569
Member Avatar for Andreas5

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).

Member Avatar for jonsca
0
183
Member Avatar for kaydee123
Member Avatar for maria99

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.

Member Avatar for maria99
0
176
Member Avatar for sarminatorius

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]

Member Avatar for jonsca
0
104
Member Avatar for shortie05

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.

Member Avatar for shortie05
-1
105
Member Avatar for emcyroyale

[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, …

Member Avatar for jonsca
0
173
Member Avatar for kunkunlol
Member Avatar for kunkunlol
0
93
Member Avatar for dumb-one

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]. …

Member Avatar for dumb-one
0
352
Member Avatar for xuele91

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.

Member Avatar for jonsca
0
121
Member Avatar for damirin

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 …

Member Avatar for jonsca
0
100
Member Avatar for RobBrown

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.

Member Avatar for RobBrown
0
156
Member Avatar for SacredFootball

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 …

Member Avatar for jonsca
0
122
Member Avatar for empror9

[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 …

Member Avatar for hsh44
0
182
Member Avatar for darelet

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? ;)

Member Avatar for darelet
0
165
Member Avatar for mohamedhassan

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 …

Member Avatar for jonsca
0
531
Member Avatar for venkat arun

See [url]http://gmplib.org/[/url] (or use [URL="http://www.mpir.org/"]MPIR[/URL] for Visual C++ and mingw without cygwin)

Member Avatar for venkat arun
0
154
Member Avatar for bbman

Why are you declaring your array as static? There's only going to be one copy over all the objects of your class.

Member Avatar for jonsca
0
100
Member Avatar for Metalteeth9

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.

Member Avatar for jonsca
0
162
Member Avatar for avarionist

[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.

Member Avatar for avarionist
0
243
Member Avatar for jmangu

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.

Member Avatar for jonsca
0
124
Member Avatar for EmilyKirby

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]).

Member Avatar for jonsca
0
78
Member Avatar for bbman
Member Avatar for emcyroyale

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.

Member Avatar for jonsca
0
171
Member Avatar for darksmokepunch

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 …

Member Avatar for darksmokepunch
0
127
Member Avatar for memstick

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 …

Member Avatar for memstick
0
89
Member Avatar for sky_aeron

Please post what you have done so far. If you are missing the formulas a quick google should bring those up.

Member Avatar for jonsca
-1
71
Member Avatar for bubacke

No, this is not possible. You could have an array of size Nnamed entry and have entries 0 through N-1.

Member Avatar for jonsca
0
54
Member Avatar for bbman

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 …

Member Avatar for jonsca
0
130
Member Avatar for RussianKös

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 …

Member Avatar for jonsca
0
229
Member Avatar for CSherman

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. …

Member Avatar for Taywin
0
129
Member Avatar for iamthwee
Member Avatar for iamcreasy

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]

Member Avatar for iamcreasy
0
341
Member Avatar for bbman

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, …

Member Avatar for bbman
0
325
Member Avatar for romyboy2k9

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.

Member Avatar for jonsca
0
293

The End.