- Strength to Increase Rep
- +1
- Strength to Decrease Rep
- -0
- Upvotes Received
- 9
- Posts with Upvotes
- 8
- Upvoting Members
- 6
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
Re: It's pretty vague. Can you give examples of other kinds of "operators" and "iteration patterns"? | |
Re: I don't believe that you ever really meant this: for(Observer user : users){ for(Product currentProduct : products){ currentProduct.addObserver(user); currentProduct.setAvailable(true); } } You meant this: for(Product currentProduct : products){ for(Observer user : users){ currentProduct.addObserver(user); } currentProduct.setAvailable(true); } The first way it adds the first user then notifies him for each product, … | |
Re: A c++ program that prompts the user to input high or low, if the person inputs high it prompts the user to input red or black. If the user inputs black it outputs "You get ice cream" however if the person inputs red the program outputs "Why I oughta...!" If … | |
Re: Take a close look at your swap. There's an error there! Your loop condition should be < instead of <=. And you can just say `half = DIM / 2;` | |
Re: Just an idea, and not a complete one at that. On the USB stick, install the chrome browser and also chromedriver, a program that automates the browser, so I'm assuming it could be used to enter a password in a form (which will show up as asterisks, of course). Create … | |
Re: What about the set intersection operator & [1, 3, 5, 7] & [0, 1, 4, 6, 7, 8] #=> [1, 7] | |
Re: You can use **dos2unix**. Just run `dos2unix *.cpp` (or whatever the suffix is). | |
Re: It's somewhat involved to test for checkmate. Testing for check is pretty easy. Can you write a function that tests if the king is in check? To test for checkmate you need to check if there is a way out of check: 1. can the king move to another square? … | |
Re: You could use the stack. Push the digits as you generate them. Then in a second loop, pop the digits and print them. You need to know when you've popped the last digit which you can either do with a counter or a sentinel value. Here's some pseudocode that uses … |