1,362 Posted Topics
Re: Do you have some idea what area of computer science/programming you are interested in? In general, preparation for a career in programming calls for study in math, science, and good communication skills. As to learning programming, don't be overly concerned about a particular language - what you learn to do … | |
Re: So once you've backspaced (or even as you backspace) output a blank space: cout << ' '; And then back the cursor up again | |
Re: [QUOTE=vegaseat;508309]A boa constrictor or is it a python?[/QUOTE] You thinking of Shel Silverstein's [URL="http://www.poemhunter.com/poem/boa-constrictor/"]poem[/URL]? (Also done a a song by a few different artists.) | |
Re: dubeyprateek's second version is the best presented. You should not ever call main( ) from within you program, that essentially restarts a new instance of the program! Avoid using labels and goto's. Personally, I'd use a do...while loop structure, so that you don't have to force the loop condition true … | |
Re: Why worry if the input is integer or floating point? Treat all as floating point and you have no problems. | |
Re: [QUOTE=limac;501806]thanks invisal but, it didn't cause any compilation error but for any number i put in it is showing -1 as the result[/QUOTE] Which code is giving you -1? Your original code? As posted, your factorial code actually results in an infinite loop. Consider what it's doing: [code=c++] cin >> … | |
Re: And as long as they are words familiar to the reader. | |
Re: Yes, you could write a program that copies the sample files to a new file, removing the leading digits, colon and space from each line. This would be a good exercise. You would not necessarily need to handle each line as a string, just read characters until the first space, … | |
Re: There are a lot of errors. You should try to find and fix them first. Read the error messages, look at the lines they point you to. One hint, you're trying to mix C style and C++ style output - choose one. | |
Re: [QUOTE=evilwrench1975;498587]miltary intelligence... quite possibly the dumbest people I know[/QUOTE] Be careful, we're watching you! | |
Re: I still have unrealistic expectations of getting back into the pants size I wore 5 years ago. When I'm in a real fantasy mood, I think about getting back into my AF uniforms. (I'm 11 years retired now.) | |
Re: Please use some code indenting to make it more readable. You join the tests for input not being 0 or input not being 1 with an OR (||), which means that if either the input is not 0 OR the input is not 1, it passes the test and is … | |
Re: A complete program would make it easier to evaluate your code. What you present does not seem to be a prime generator (something which will list out the primes in a given range) but rather, a tester for a given input number - is this prime or not. And at … | |
Re: Here's probably all the [URL="http://matija.monitor.hr/murphy/0001567/download/edition.htm"]Murphyisms [/URL]you could ever want or need | |
Re: [QUOTE=MidiMagic;493349] Totally virus-proof computer: Tandy Color Computer. The OS is in ROM, so it can't be compromised.[/QUOTE] The only totally secure computer is the one you put into a strong safe, with no power or data connections. Weld the safe shut, toss the safe into a deep, deep part of … | |
Re: Here's some details, looks there were several events: [url]http://pasadena.wr.usgs.gov/shake/ous/[/url] Val | |
Re: [quote]49% of all statistics are wrong. -Anonymous.[/quote] 86% of people that quote statistics make them up. | |
Re: [QUOTE=mrjoli021;496280]It gets included by default.[/QUOTE] really? With [code] #include <iostream> using namespace std; [/code] some of the string functionality is available. But not all. I can allocate and assign strings, and access string function. But curiously, iostream overloads are not available with including <string>. I suppose it's a matter of … | |
![]() | Re: Put all the digits in an array, one digit per element. In a loop, display a character, then execute some delay mechanism for 1/4 second. Display next element.... A piece of code I believe I saw in another post here (sorry if I'm stealing someone's thunder) that will do the … |
Re: Well, there are many comments to be made. In your Binary Input file, you open the file for in/out and you truncate it. So, anything that was in it before is lost. Is that your intent? Your console input problem with multiword names is due to using the extraction operator … | |
Re: A makefile contains various commands, controls, configurations, and file names used to compile and link a project. And much more. Google makefile and you will find lots of references and tutorials. | |
Re: Value 223 (base 10) is 11011111 (base 2). Note that the only 0 bit is the 6th bit (counting from the right, the low end). So, when this value is bitwise ANDed with a number, every bit of the original value, except the 6th, will retain its original value. Remember … | |
Re: First, how does it compile without the <string> library included? Once that's fixed, it does output, to the file, as you designed the program to do. Your input, however, will not be correct, using the [inlinecode]infile >> inputNode.lastName >> inputNode.firstName >> ....[/inlinecode] method. This gets one "word" at a time … | |
Re: The error messages are pretty clear: pim.cpp: In method `void PIM::search(class basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >)': pim.cpp:101: member `firstname' is a private member of class `Person' pim.cpp:101: member `lastname' is a private member of class `Person' These mean you cannot directly access the first/last name members, use the get____ methods you created. pim.cpp:105: … | |
Re: There's a [URL="http://programmerday.info/"]website [/URL]for the holiday! | |
Re: We need to think outside the box, shift our paradigms, and boldly go where no (fill in the blank) has gone before. | |
Re: Just for the record, the sort you're trying to implement is a Selection sort, not Bubble. | |
Re: Well, in dog years it's 29;) The real question is, does it still function well, does it do what you need it to do? My main machine at home is a 5 year old Dell Dim 4500. I've added RAM, larger hard drive, and DVD writer to it, and it … | |
Re: Nah, that one's just so much noise it goes in one ear and out the other. Now, you want something that will stick and annoy, how about this old disco hit: [url]http://www.youtube.com/watch?v=ZOtC-xvmFJI[/url] Val | |
From the standpoint of writing the sorts of programs first and second semester C++ courses use (fairly simple command line programs), has anyone found any significant differences in the VS IDE or how C++ programs compile, compared to the 2005 version? thanks, VAl | |
Re: In that case, you must pass both arrays to the sort function. When you exchange members of the array upon which you are sorting, also exchange the same members of the other array. | |
Re: This same problem appeared in an earlier post (within the last day) [code] while ((pal = cin.get() != '\n') && (index < (MAX - 1))) [/code] is not doing quite what you want it to. Look for the previous explanation. When quoting error messages, it helps to give the line … | |
Re: Do you mean that you want [b]i[/b] to be one larger every time you call the function to output a line? How about making it a static variable, as in: [code] ostream &operator << ( ostream &output, const Course &xCourse ) { static int i = 0; output << " … | |
Re: In your reading loop, the input statement needs to be enclosed in parens before comparison to newline character, as so: [code] while ( ( (ch = cin.get()) != '\n') && (index < MAX-1) ) [/code] Othewise, ch was not being assigned the character read in, but rather, the result of … | |
Re: end( ) returns an iterator pointing to the last object. back( ) returns the last object( the value ) | |
Re: The object pstr is an address. When you return pstr from the function, the value of that address is returned, so that in the calling function, you assign that address to ps. If you can step through the code in a debugger, notice the value (address) pstr has, and the … | |
Re: If you mean why are the low and high temps shown twice - it's because in those function you have the loop running two iterations. In fact, what you show are the highest high and the highest low, and the lowest high and the lowest low. Also, in both the … | |
Re: to do any realistic comparisons of sorts functions, you'll need to use a larger data array. Even then, on a modern PC, the time to sort will be so quick, you may have to run the sorts many times in succession to see a difference. Access the system time before … | |
Re: The j loop need only go as far as the current value of k - no need to test past the point of where you've successfully stored data. The j loop doesn't work well as a for loop - you will continue testing and assigning even once you've found that … | |
Re: You have to do the whole algebra thing. [code] (S + L)/2 = S/2 + L/2 S + (L - S)/2 = S + (L/2 - S/2) = S + L/2 - S/2 = S - S/2 + L/2 = (2S/2 - S/2) + L/2 = S/2 + L/2 [/code] … | |
Re: Generally, if you are running your program from within the Visual C++ (Visual Studio) environment (using the Debug menu), your input/output files will be in the project folder - the same place you find your .cpp file. If you try to run the executable directly (in a command window or … | |
Re: How does [code] void getCardValue(cardValues & userCardValue) { int value; cout << " What is the value of your card? => "; cin >> value; if( value >= two && value <= ace ) userCardValue = cardValues( value ); return; } [/code] work for you? Val | |
Re: That's not a whole file, so how is one to replicate your problem, or even undertand what we're looking at? Without the variables and function parameters, it's just some code. Which line does the error message point to? | |
Re: The code you posted looks like it should just print the number stored at the last node visited in each smaller and smaller walk through the list. If you are seeing 1 2 3 4 1 2 3 1 2 1, then you probably have moved the output statement inside … | |
Re: I think it's going to take a week to get that tune out of my head!!!!! | |
Re: No, line 18 is not your problem. Perhaps you need to better identify where the program crashes - put some output statements that tell you when you start each section, step through it in a debugger, .... Posting the whole code so someone could attempt to recreate the problem would … | |
Re: Have you made an attempt to modify the program to do so? Please post that. Val | |
Re: Have the inner loop start at 1, go up to or equal lineCtrl, incrementing along the way. Val | |
Re: Not that I know of. You have to read some (all) of the file, then search using any of several possible methods. If you expand on your problem definition, and show the work you've done to solve it, you will get better help here. Please read the forum rules. Val |
The End.