1,362 Posted Topics
Re: Do you really mean along the x axis, and changing their y position some amount per second? We don't solve problems here, we help you with your solution. Write some code, ask some questions. | |
Re: `cin >> "Enter number"; ` You cannot do input to a literal string. You need a variable as the right hand side of the extraction operator (>>), like: int num; cin >> num; int rolls; cin >> rolls; You don't necessarily need to follow an input statement with an output … | |
Re: First, you're not reading in the name, you go straight to SSN. So input will hang up right there, seeing characters that don't match int type. Second, once you get past the name, SSN with dashes won't go into the int field, either. Nor will the hours, which have a … | |
Re: I don't think the .ignore( ) is needed after 36 or 40, only after the last extraction operation before the loop goes back to getline. So only at line 52. | |
Re: In both cases the output is just one single "ok", you are displaying just the literal text you see there. The declarations of the int or the char have no effect on the following output statements. Is there more to your problem that what you're showing? | |
Re: Posting thrice doesn't get you extra credit. First show us some attempt to solve the problem, then we'll help you with your difficulties. | |
Re: "goto loop" ??????? Why not just write a loop? You can easily wrap your code in a do...while structure | |
Re: From your code, I'm assuming the matrix will be filled completely, so ROWa is a valid limit on number of rows to search. If the size you search for can be in any position in a row, the best you're going to be able to do is return the row's … | |
Re: To add. The program did not read the last line twice, it failed to read anything in the last attempt and the previous values were used again. Two ways to correct this. My preferred way is to use the input as the loop condition. If the input succeeds, there is … | |
Re: As a general approach, I would start by iterating through the map completely, displaying the words of length 1. Then go though again, looking for length 2 words, etc. As you make a pass, keep track of the longest length that exists, when you display the words of that length, … | |
Re: A - We don't do your work for you. You write code, tell us what problems you have, we'll help you work it out. B - You also need to give a problem statement that is comprehensible. | |
Re: It would help if you told us what errors you were getting and what lines they seem to appear on. For that matter, if you would look at your compiler error messages closely, they point you to the several things you need to fix just to get it to compile. … | |
![]() | Re: > what exactly is the difference between a doll and an action figure? they are both representations of people with which the child can act out various activities. Is putting a SWAT vest on a GI Joe fundamentally different than putting a cardigan on a Barbie? OK, let's compromise and … ![]() |
Re: Also, if you intend to get firstname lastname in one string input, you'll need `getline()` `cin >> a_string; `will store just one word's worth of content, stopping at the space between name parts. `getline( cin, a_string );` will read everything till the newline. In line 24, if you want to … | |
Re: If that is the way the assignment was given, then the only real way to go about it is to first use if/else branching to put the purchase into some discrete cagetory. Then write the switch to use the category value. As AD put it it, this really is an … | |
Re: First show some work. Then we'll help you with specific problems. The two groups of functions you are aske to replicate are really pretty simple. Your biggest task is to actually instantiate the strings. | |
Re: between lines 32 and 33 you need to keep a separate running sum of each tellers' total days. It looks like you were planning for `total` to be that sum. | |
Re: [quote]test plans, desk checks and dry runs. [/quote] "Desk checks" - there's a term you don't hear enough anymore. And to get students to do such - unheard of! Narue's comments are spot on. If students (and real life programmers, as well) would spend more time checking, tracing, double checking … ![]() | |
Re: Lines 24-26 leave you with the value of number 2 as the correctanswer, but that value is not what you get from dividing number1 / number2 If you want to ensure that n1 and n2 result in an even division (no remainder) you'll probably have to generate them in a … | |
Re: Where is it written? If you follow up the chain of library files, you'll come to: yvals.h Which has the line: `#define _STD_BEGIN namespace std{` Most every library file, after its #include statements, leads off with: `_STD_BEGIN` (at least that's where it exists in MS Visual C++) | |
Re: Lines 10 and 11 do nothing. Lines 12 and 13, you are doing integer division of integers that are as yet uninitialized. Then in 15 you do input to the variables that should hold the resulting fractional value. Your if statements make no sense. Where you should be going is … | |
Re: It doesn't look like the publisher put out a legit ebook. For a 2001 edition, ebook versions weren't so common. | |
Re: Thus far, I have no faith in the electronic voting as presently implemented. There are too many demonstrated instances of faults in the systems, whether intentional or not. The lack of reliable and verifiable audit trails makes them suspect. We have enough voter fraud in the USA with the various … | |
Re: Not all of those are so dumb, when you consider the context and time. > Women may not drive in a house coat. > > This is insane, what is the difference between a house coat and a church coat? IQ LEVEL : 2 A house coat is a robe, … | |
Re: AD, what you asking for the shares? As to coding, what kind? C, C++, Morse, Genetic, Crypto? (I apologize, I couldn't help myslelf.) | |
Re: Well, that was a moderately annoying website. But I'll play along. > Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. > > So far, the Universe is winning. > --Rick Cook | |
Re: For the problem you have, your output function needs to be set up like your ShowData(). You'll have to decide how you want to write the data to the file. You could write all the names, then all the data, by rows. Or you could write a name, then all … | |
Re: In line with AD's comment, you can readily get your indenting cleaned up by selecting the code (ctrl-a) then, while holding the control key down, press K and then F. That would show that the last closing } in your code is indented two levels. | |
Re: Putting it in a readable form: void foo(int i) { if(i>1) { foo(i/2); foo(i/2); } cout<<"#"<<endl; } I don't see where a 7 results, regardless of input. This function doesn't really do anything other than waste time and memory. What's your real question? | |
Re: [QUOTE=sneekula;696891]There is ample evidence that work can be enjoyable, and that indeed, it is often the most enjoyable part of life.[/QUOTE] I enjoy work. I can watch people do it all day long. ;) | |
Re: In both the distance( ) functions above, you pass in a miles(driven) paramenter, then do an input action to that value. The general concept should be that the user of an instance of your car supplies that value to the car object, through that parameter, and the car just makes … | |
Re: Counting to infinity is not possible, with a computer or not, unless you are Chuck Norris. To use the printf( ), you'll need to include <cstdio>. You'll need to either write the prototype for your gotxy(), or move the funtion to be before main(). It looks a little more fun … | |
Re: #include <iostream> int main() { std::cout << "Hello, would you like to ask a question?" << std::endl; return 0; } | |
Re: You are using { } to contain your logical conditions, when you should be using ( ) Your second block looks like it should have the time of day test as an if, not else if. You have a loop at the end to keep doing the calculation, but no … | |
Re: even with the return statement moved to the end of the function, the line `cout << arr1;` will not display the array contents. You need to walk through the array, displaying each element's value one at a time. It is left as an exercise for the OP to explain what … | |
Re: Google is your friend. Try the first link that comes up: http://lmgtfy.com/?q=online+tutorial+c%2B%2B | |
Re: 1. Please read the stickies above about how to ask questions here. You must show some work, ask direct questions about problems you encounter. 2. Your question does not really make a lot of sense, it seems to contradict itself in regards to what to do with the ith digit. | |
Re: Try stating it in words: if sales are less than 20000, commission is 4% otherwise, if sales are less than 40000, commission is 6% otherwise, if sales are less than 50000, commission is 7% otherwise, commission is 9% With this, you can create a flowchart with 3 decision shapes. Remember, … | |
Re: I would research the development environment I'm using to see if it directly supports opening images. What sort of images (jpg, bmp, tiff?). Determine what you want to do with the image. Display it? Just determine information about the image? Do modifications to it? Convert it to another format? You … | |
Re: You don't need the while loop. Just decrememt postion as the loop does, then do the divide and modulus and ... voila. Well, that works when the position given is actually within the number. Do you need to handle the case of user asking for 7th position of a 3 … | |
Re: You are processing all the inputs in the while loop. Then you one time write a value to output. Only the last data from the input reading gets stored. I'd restructure to open the output file right after you've opened and tested the input file. Then after each input line … | |
Re: You need to show us some work. Perhaps you should also provide more detailed specs on what you're trying to do. Code indentation can have several variations in the approach one takes - what are your guidelines? | |
Re: Implement a James Bond changing license plate. | |
Re: Muhammad, you should start by opening your own thread, not piggybacking on another, unrelated one. Secondly, read the sticky at the top of this forum section where you'll see we don't do your homework for you. You write some code, post it and ask questions about problems you have with … | |
Re: If you want to do Windows programming at the API level, I'd pick up Petzold's "Programming Windows". It's a bit dated now, but it digs into the innards like nothing else. | |
Re: I'm with the Rev on not feeling kindly disposed to those who appear to be English speakers writing badly. Trying to decipher a text-speak query is a pain. I often think the non-English speakers often do a better job of communicating. I have seen Google Translate do pretty credible job … | |
Re: As long as we're giving all sorts of answers, how about for(int i = 0, j = len-1; i < len/2; i++, j--) { temp = str[i]; str[i] = str[j]; str[j] = temp; } | |
Re: I'm confused by the assignment statement. You cannot directly pass a column from the 2D array to the sort functions. You can, and you are, passing rows from the array. Also, your loop in main sorts a row with the bubble sort, then sorts that row again using selection - … | |
Re: Did you sort the list after it was generated? If you generated 200 random numbers in the range of 1-30, you should expect about 6 or 7 of each value to occur. Even in your set or 30 values, you will get duplicates. | |
Re: Have you tried asking the NSA to ease up on its monitoring of your activity? |
The End.