How in the hot pocket do I get my C++ code working
making it myself? Didn't work, trying to memorize something? Nope, literally copy and paste? Still errors
Mira Hedman First you need to understand the basics of how c++ works so hopefully you're doing the lessons😁 Here's a very simple game. It generates a random number between 1 and 3. You run the program, when the dialog box opens enter your guess and submit. The output will tell you if you win or lose. https://code.sololearn.com/cMxr3hkkEE5b/?ref=app
Mira Hedman What code? What are you trying to do?
Mira Hedman C++ is a programming language so if you want it to do something for you then you need to know how to "talk" to it and give it instructions. Have you started the lessons yet? https://www.sololearn.com/Course/CPlusPlus/?ref=app In your code you are using cout which is an instruction for it to print something but that's it. So it will not do anything else. Start slow, it will come quickly though if you practice. So you know cout will print, now learn how to use cin. cin asks for input. cout will print the output.
Scott D like a simple game like if you run it there is a chance that you lose or win
Mira Hedman Here's an example of cin and cout. Then you need to learn the difference between how c++ deals with different information. string - used for words and sentences etc. int - used for integers (whole numbers that don't have decimals like 4 or 312) Here's an example of using cin and cout. https://code.sololearn.com/chVw9jOa5030/?ref=app
Mira Hedman Here's another example. There are now other instructions to tell the program to add together 2 numbers (integers). This code lets you enter a number then adds 10 and prints it. Try altering the code to add 20 to the number you enter. Try some lessons. If you have questions ask me or the discuss forum. And learning how to alter code is good practice. So for example with the game I posted, save a copy. Leave in the code, but change only the cout statement to print something like "Sorry, wrong guess" and "You're a winner! " But the other code is the instructions to c++ to perform the game. If you remove it and only have cout then the code doesn't know what it should do except to print something. Again, do the lessons. It doesn't take long. I've only been doing this for a few weeks. And it becomes more fun as soon as you learn how to tell c++ how to do what you want it to. Feel free to play with other code like mine just to see what it does. https://code.sololearn.com/cP0l31LiDG7L/?ref=app
How do I generate a list with <N> unique elements randomly selected from another (already existing) list?
Given three integer matrices A(m*n),B(m*n) and C(m*n) . Print the one with more zero elements. beside code
I'm coding this for hours & can't make the value of the 5 random numbers round off to 2 decimal places like in the examples
Overloading + operator
( NEED HELP ) Halloween candy