1,362 Posted Topics
Re: [icode]if (s1.at(i) == s2.substr(s2.length()-i-1,1) )[/icode] is attempting to compare a character to a string. Even though you limit that substring to one character, it's still a string. | |
Re: Printer - yes. Mouse/trackball, not so much. A stream is the source or destination of a series of data, either characters, or in the case of binary files, a sequence of bytes that represent memory content. Since it's an abstraction, you can operate on any stream in the same manner … | |
Re: How big a block are you reading from the source file? It might be the file I/O is your bottleneck if you read in many small chunks. | |
Re: [QUOTE=SantaPotato;882940] (PS- I heard Vista users get a free Windows 7 upgrade. Do I need a CD for that?) Thanks for reading. :)[/QUOTE] You probably heard from someone who doesn't know what they're talking about. With the recent announcement of a 22 Oct release of Win7, there will be a … | |
Re: [QUOTE=vegaseat;881229]The only perfectly empty space I know of, is in the cranium of certain politicians. Yes, in that space many scientific laws malfunction.[/QUOTE] I was going to say something along that line of thought - I like yours. 'Nuff said! | |
Re: left control, right shift, and space bar seem to be the most beaten up on the one keyboard I have that's seen enough use to show wear (it's only about 7 or 8 years old.) | |
Re: With your project open, use menu Project | Properties, Configuration Properties, General. There you should see the path for the Release execuatable ( .\Release). If it's not that, set it to be so. | |
Re: Instead of the big if...else if block, how about [code] for( int i = 0; i < 10; i++ ) { index = arr[i] / 10; str[index] += "*"; } [/code] | |
Re: The Read Only attribute has no meaning or effect on folders, ignore it. Your problem is permission - are you running an account that has administrator privelege? You might try taking ownership of the temp folder (are you sure you're looking at the right folder, usually it's C:\Windows\Temp or C:\Documents … | |
Re: Or, have the outer loop go by steps of 2, and use its current value as the limit for the inner loop that prints the *s. | |
Re: It should be found in C:\Program Files\HP\Shared or some similar folder. It's believed to be the used by the program for the LightScribe functionality for your DVD drive, but this is not confirmed by any info from HP. I don't find any direct way to halt it or stop it … | |
Re: [URL="http://www.educ.umu.se/~cobian/cobianbackup.htm"]Cobian Backup[/URL] | |
Re: Um, this is a C++ forum. You'll get more and better response in the C forum. And, csurfer, using eof( ) in that manner is going to unreliable at the end of the file, last value read in could be processed twice. This has been amply discussed on the forum. | |
Re: I would expect temp to still be be an empty string. Note that an empty string is one which has no content. It is not the same as NULL. | |
Re: Your question is bit open ended and not fully clear, but how about a file that contains the names of all the various data files. You open and read that, storing each file name into an array element. You can then open whichever data file(s) you need. Perhaps even have … | |
Re: Windows 7 is the next version of Windows, succeeding Vista. But hey, you could have found that very easily with just a quick googling. Would have gotten you an answer about 21 minutes ago. | |
Re: Your use of strcmp( ) is correct. However, your strings aren't strings. You must allocate memory for s1 and s2 as arrays of char. Or declare them as char pointers and then allocate with the new operator. Your subject says "strncmp( )". If you want to use that variant, which … | |
Re: Your code does in fact have a main( ) function? And you did add the code file to the project? Look in the Solution Explorer - is your code file shown under the Source Files subfolder? | |
Re: If you mean to change what page is used as a home page, that depends on which browser you're using. Firefox - Tools | Options | Main tab IE - Tools | Internet Options | General tab | |
| |
Tried to read some newsgroups I follow, got "server not found" replies. They've had problems in the past, so I called tech support. Was told they dropped usenet, today. No notice, no warning, nothing. Just gone! I've got half a dozen or so newsgroups I follow, some related to hobbies, … | |
Re: Putting the break (or exit( )) inside the if block is not a wholly satisfactory method. The conditions in loop ought to indicate when/why the loop ends - don't hide surprises inside the body. How about a structure like: [code] inData >> num; if( num < 5 ) { do … | |
Re: A common, simple model for entering data till there is no more is something like: [code] struct empl {string name; int ID, department; }; empl workers[10] int limit = 10; int count = 0; while( count < limit && getline( cin, workers[count].name ) { cin >> workers[count].ID; cin >> workers[count].dept; … | |
Re: Case 4 - where to start!? You cannot just declare a char* and then use it for input - you must allocate memory to the pointer. Why not just allocate it as a char array, like [icode] char strSearchData[128];[/icode] (Choose a size you think is sufficient for any fool who … | |
Re: Laughter - the best medicine. And the only one we'll be able to afford? | |
Re: Looking at the grade evaluation problem [code] int dataGrade() //function that shows table and grade { if (average <= 100 && average >=90) //am I doing this right? grade = 'A'; //I feel like something is missing? else if (average < 90 && average >= 80) grade = 'B'; else … | |
Re: Firstly, please don't write in ALL CAPS. It's considered shouting, and is a bit rude. Secondly, please don't keep starting new threads on the same code problem. I see at least three other threads, under two user names. Thirdly, does your student data file in fact have exactly as many … | |
Re: I enjoyed the movie. Yes, it changes some of the ST canon that many feel shouldn't be violated, but, hey, that's what time travel is all about. If you're in a bookstore, look for the novel based upon this movie (or is the movie based on the novel, or are … | |
Re: You cannot get input to pointer s without first allocating it some memory. What you're doing is attempting to store to whatever memory address s points to, which could be pretty random! If you've not allocated the memory, you don't control it. If you don't control it, you should not … | |
Re: Your readfromfile( ) does nothing but read through the file, it does not store anything to your array of students. In the addStudent, what's wrong with the following bit? [code] cin>>tempValue; temp_array[num_of_students].Mark1 = atof(tempValue.c_str()); [/code] Where are you attempting to store data? | |
Re: Imagine you have it all drawn out on paper - the locations of customers and the potential store sites. How would you solve it manually? Approach it from a strictly procedural method - don't assume anything that you as a human might see from the particular data set. Rather, how … | |
Re: What compiler? Your statements work fine in VC++ 2008 | |
Re: It looks like you're close to having a working program. Have you tried compiling? If so, you'd find that you have two errors. One is a missing #include and the other is a small typo. Find and fix those. Then you'll find a problem if you try to enter a … | |
Re: Your code is C. This is a C++ forum. It looks like it should do what you ask. Does it run? Does it give the results you want? What's your question? And, when you post code, please put it between code tags, thusly [noparse][code] your code goes here [/code][/noparse] | |
Re: And get rid of the excess "out<<" in your ostream method. It'll run as is, but give odd results. | |
Re: One problem, you're mixing data types. [code] char ....... , i; { ifstream array2; array2.open ("array.txt"); array2 >> i; for(a=1;a<=i;a++){ [/code] You read in to the character i, getting the character '3'. When you use i as the for loop limit, it gets typecast to an integer value, its ASCII … | |
Re: Just remember. Without electricity, much of which comes from coal, we wouldn't be carrying on this conversation. | |
Re: Your first line creates an array of int pointers. The p[i] line allocates memory to each of those pointers, in effect created an 2-dimensional array of ints. So, each p[i] is the name of a single 1D array of int. | |
Re: Lets start with an easy one [code] void StuRead(&ifstream studentType students[]); [/code] The & goes after the data type (ifstream &) and you need to put a comma between the two arguments. If you're going to put the parameter name on one, why not both? So, a corrected version of … | |
Re: Spybot also has such a feature. They don't identify every registry change - you'd never get any work done if that happened. They generally indicate when some program being installed/updated wants to change the registry. | |
Re: Is that CD actually an XP install disk with SP3 included, or just the SP3 update? | |
Re: Three children with names associated with Hitler's Nazi movement? I don't think it takes much reading between the lines to see what's going on in this family. | |
Re: OUCH!!!! Just add scope resolution operator (::) doesn't turn a function into a class member. And the member function shouldn't have to deal with any outside objects, like any particular file. That's not a good implementation of a class method. A method is an action that a class object takes … | |
Re: Why do your write the number of records to the binary file, but not read it it back? Instead, you're reading in the full (potential)size of the array's worth of data, which will include that one int at the front of it, putting everything else out of sync. This line … | |
[URL="http://www.cracktwo.com/2009/05/72-old-computer-ads/"]Fun stuff here[/URL]. How many of these ads do you remember seeing when they were fresh? AD- you don't have to answer! | |
| |
Re: In the simplest sense, all you need are to modify the #include's to the current C++ forms [code] #include <cstdio> #include <cstdlib> #include <ctime> #include<cstdlib> [/code] Compile and run. C++ will use the C output methods. If you really want to make it all C++, you'll have to change the … | |
Re: What it looks like you're doing is displaying floats so that they will line up at the decimal point. Your loop to count digits is only counting the whole number portion. If you're trying to mimic the setw( )manipulator, you're going to have to know how many digits fall after … | |
![]() | Re: I wouldn't call the problem of comparing floating point values for equality "undefined". There's a pretty clear definition of what happens - the two values are compared returning a boolean value. I would describe the procedure as "unreliable", in that two values which may be (ought to be) the same … |
The End.