1,362 Posted Topics
Re: If they are member variables of the class, they are not global. They are, as you note, accessible to all functions of the class. However, they are accessible only within a given instance of the class. If you have a variable temperature in class World, and you have multiple worlds … | |
| |
Re: You could start by reading [URL="http://www.daniweb.com/forums/thread215615.html"]this very similar thread[/URL], which at this writing is right above yours. | |
| |
Re: You can write Windows programs (or GUI programs for Linux or Mac) in C++ (or C). It requires more than what you probably find in the basic C++ book - you have to use the GUI's API (application programming interface) - those are functions that directly interact with the windowing … | |
Re: To turn on automatic indenting of blocks Tools | Options | Text Editor | C/C++ | Tabs select Smart Indenting | |
Re: Yes, you need to clearly describe what you're trying to do. A - are you storing the z value at each and every x,y coordinate? Such as, elevations at geographic positions. If so, you can really treat this as a 2D problem, where the data stored at each x,y cell … | |
Re: If the code above is in a loop, where you ask for a new word to seek, your problem is that the file is left pointing past its end. Unless you do [code] dict.close( ); dict.clear( ); [/code] before you open the file again, you will not be rereading the … | |
Re: I was just about to post a link to that video, and ask if people thought it too graphic and grisly. Personally, I think this should be seen by every last person that has a cell phone - teen or adult, driver or not. There is no communication or message … | |
Re: if your file looks just like the example you give, why not read each line into separate strings. If the second string has the value you interpret as activated, then use the password found in the first. | |
Re: Declaring the array as you're trying to do, you MUST declare the sizes of the row and column dimensions*. To allow the user to enter the size at runtime, you'll have to use dynamically allocated array, that is, pointers. Generally speaking, this is the pattern: [code] int **game ; int … | |
Re: A static data member? [code] class foo { private: static bool vis; char ch; public: void change_vis() { vis = !vis ;} //other member functions }; bool foo::vis = true; //initialize the member [/code] or [code] class foo { private: static bool vis; char ch; friend void change_vis(foo &a ); … | |
Re: You need to join the modes with bitwise OR ( | ), not as comma separated parameters. [code] myfile.open( "myfile.txt", ios::app | ios::in | ios::out ); [/code] Opening with append mode will not allow you to overwrite the file content, all you can do is add to the end. If … | |
Re: As long as you are guaranteed that the item names will be only one word, this is not a hard problem. Your numeric data items should be type int, with the item name being a char array, as you have. Your reading line stays as you have it. From the … | |
Re: Hijacking threads is not looked upon kindly - start your own for a new topic. Read the announcements - we won't do your homework for you. If you tell us which answer you think is correct, and explain your reasoning, we'll be more inclined to help. | |
Re: [QUOTE=firstPerson;949951]I think this is supposed to be a recursive pow() function.[/QUOTE] Nope, it another commonly used function. Step through it. One way you might examine what's happening, and get an understanding of recursion, is to get a bunch of small pieces of paper. Use a piece for each recursive call. … | |
Re: Use type [icode]double[/icode] instead. This will give you about 15 digits precision, compared to a float's 7 digits. And an alternative to the formatting: [code] cout.precision(10); //substitute the # digits you want after decimal cout << fixed << showpoint; cout << pow( f, n ); [/code] | |
Re: [code] for(int i = 0; i <= Flowers; i++){ Flowers[i] = i + 1; [/code] Don't you mean [icode]FlowersInHeap[i][/icode] here? And, the big problem, is using <= as the test comparison. For Flowers = 5, you are trying to access elements 0 through 5, which is a total of 6 … | |
Re: keywords "private" and "public" must be all lowercase. You're throwing the compiler for a loop before you get anywhere. Also, right off the the top, your getname( ) function must have return type of string, not int. | |
Re: When you set up the project, you need to select "Win32 Console app", not "Win32 app" | |
Re: It depends on the size and complexity of program you're trying to write. If it's a small program and the validation is short and simple, it would not be wrong to check the arguments in main( ). If the testing was more complex, you could pass the argc and argv … | |
Re: [icode](rand()%4)+1[/icode] can only give you values from 1 to 4, so you're going to have duplicates, possibly several of the same. To get unique values, at each assignment you have to examine the previously chosen numbers and reject any duplications as you create them. Frankly, giving an assignment like this … | |
Re: Yes, you must use a constant value in your array declaration. Recent change to C language allows use of a variable size, and "some" C++ compiler(s) now accept that usage, but it's not standard for C++ yet. Using the values found as the index of the counting array is bound … | |
Re: A C-130 that went from 25,000 feet to parked on the ramp in 5 minutes. Pilot was late for a hot date, I think. | |
Re: That's right up there with the continual exhortations to "do more with less." Eventually, we can do absolutely everything with absolutely nothing. | |
Re: fin.getline( message, MESSAGE_SIZE, '\0' ); -or- getline( fin, message, '\0' ); These cause the input to read till a NULL is encountered, which should never happen. Thus, it will read till end of file, storing all to the single string variable. The newlines in the input file will be preserved … | |
Re: [quote]...have a giggle at someone else's expense ...[/quote] see: US Congress | |
Re: What might be a valid message goes by so fast, the viewer is lost. I will agree with you that some green regulation often goes through without full thought of the consequences. | |
Re: Or besides getting delayed (4 days last trip I took) or just plain lost (does it go to the same place as odd mittens and socks?), the airline gorillas could just simply [URL="http://www.youtube.com/watch?v=5YGc4zOqozo"]break your stuff[/URL]. | |
Re: You probably need to follow the steps in these [URL="http://msdn2.microsoft.com/en-us/express/aa700755.aspx"]instructions [/URL] for setting up the Windows SDK in VC++Epress 2005 - telling VC where to find the includes and libs and executables. | |
Re: 10 seconds with google finds [URL="http://gethelp.devx.com/techtips/cpp_pro/10min/10min0400.asp"]this[/URL] But, I would not put the [icode]<< endl[/icode] in the overload - that limits how you can use it in building up outputs from multiple object. | |
Re: It would help to also see sample of how your data is formatted in the file. I'm assuming it's something like: album name 1 song 1 song 2 song 3 === album name 2 song 1 song 2 song 3 === album name 3 song 1 song 2 song 3 … | |
Re: There is seldom, if ever, the need to use exit( ) other than for some abnormal ending. If your program runs correctly and completely, the return(0) at the end of main( ) will cause the program to gracefully end. You have the char "oper" and the string "op" which both … | |
Re: Big thing is you're not storing all the input file [code] while(getline(fs, line)) { cout << line << endl; } [/code] reads a line from file, storing to string "line". Then it reads next line from file, overwriting whatever was in "line". So you'll only have the last line of … | |
Re: Perhaps a success/failure indicator? Are you to provide negative results if Y is larger value than X, or should the operation not proceed in that case? In other words, is the value in Z to be considered a valid result or not. | |
Re: He promised us Change. He begins that by stacking his cabinet and senior positions with recycled Clinton era political hacks. Turning the [URL="http://www.foxnews.com/politics/2009/02/03/obama-getting-heat-for-turning-up-thermostat/"]Oval Office into a tropical greenhouse[/URL], as he tells us we must cut back on energy usage. Q: How do you get a Democrat politician to pay all … | |
Re: 9 posts and you can't find the correct forum? Your code is C, not C++. That said, your logic is generally correct. I would not expect you to put the text in the output file, just the values. In computing the average, remember that integer division gives an integer result … | |
Re: [QUOTE=Ancient Dragon;874761]We have a lot of ghosts here in St Louis -- they even vote every election year :)[/QUOTE] I thought that was mostly a Chicago thing. I think the ghosts of my cats that have passed on come back to annoy the cats that are still here. Every now … | |
| |
Re: [QUOTE=EnderX;548188] My preference, frankly, is for 'Southern', not because of the accent, but because, with the (mostly)death of Middle English, this dialect is the only version of English which remains (to my knowledge, at least) to bear the distinction between the singular and plural forms of the second person. (Although … | |
Re: you will have to implement some means of checking the numbers already assigned to a row. either iterate through the numbers already picked, and if any match the new number, discard it and generate a new one. Or, a bit quicker, set up an array of size 40 (or 41), … | |
Re: [QUOTE=nakemaro;890422]but the teacher told us that she there is way ro do that becouse she has plenty of project so she doesn't want to copy and past everytime thanx ^^[/QUOTE] Well, then the teacher should give you instructions on how to set up the project. Not sure if it will … | |
Re: Control Panel | System Or right-click My Computer, Properties, System Restore tab | |
[URL="http://gizmodo.com/5111630/"]Gel Remote Control from Panasonic.[/URL] | |
Re: Stated that way, it its a bit of a confusing thing. But, your second question can help put it into perspective. I'm assuming a and b are pointers to arrays of some type. The * would dereference the pointers, giving you the values pointed to. So the value b points … | |
Re: Nice drive, done it from your area to my home in Rapid City several times the last few years. This list should get you across to WI [url]http://511.idaho.gov/default.asp?display=allAdvisories&area=&textOnly=[/url] [url]http://www.mdt.mt.gov/travinfo/[/url] [url]http://www.wyoroad.info/[/url] [url]http://www.sddot.com/511.asp[/url] [url]http://www.511mn.org/[/url] [url]http://www.511wi.gov/Web/[/url] | |
Re: Perhaps you mean you have to include the path to the binaries/libs/includes for your compiler? We'll need to know what compiler/IDE you're using to give you good instruction. | |
Re: [URL="http://www.youtube.com/watch?v=tGvHNNOLnCk"]Steve Ballmer selling Win 1.0[/URL] |
The End.