0

Instructions "John wrote a program that picks random numbers from 1 to 20. The program then ask users to guess the number it pic

29th Mar 2023, 4:48 PM
EMMANUEL ANTWI DOKU
EMMANUEL ANTWI DOKU - avatar
9 Antworten
+ 6
EMMANUEL ANTWI DOKU , it is better for you to *start your own post*, otherwise poeple will not get aware of you. please also include your current code in the post.. also it is not clear if the task description from this thread is identical of what you want to know.
31st Mar 2023, 4:03 PM
Lothar
Lothar - avatar
+ 5
EMMANUEL ANTWI DOKU , > please link your code try here
29th Mar 2023, 4:58 PM
Lothar
Lothar - avatar
+ 2
Do you run the code? Are you facing any trouble? Are you getting the output you required? Corrections depends on these your answers!!..
29th Mar 2023, 5:28 PM
Jayakrishna 🇮🇳
+ 1
#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { srand(time(0)); // seed the random number generator with the current time int number = rand() % 20 + 1; // generate a random number between 1 and 20 int guess; do { cout << "Guess a number between 1 and 20: "; cin >> guess; if (guess > number) { cout << "Choose a lesser value." << endl; } else if (guess < number) { cout << "Choose a greater value." << endl; } else { cout << "Congratulations! You guessed the number." << endl; } } while (guess != number); return 0; }
29th Mar 2023, 5:01 PM
EMMANUEL ANTWI DOKU
EMMANUEL ANTWI DOKU - avatar
+ 1
Alright Thanks
29th Mar 2023, 5:35 PM
EMMANUEL ANTWI DOKU
EMMANUEL ANTWI DOKU - avatar
0
Please this is my first time taking this I honestly have no idea where to begin
29th Mar 2023, 5:00 PM
EMMANUEL ANTWI DOKU
EMMANUEL ANTWI DOKU - avatar
0
Any corrections to this code
29th Mar 2023, 5:02 PM
EMMANUEL ANTWI DOKU
EMMANUEL ANTWI DOKU - avatar
0
I don't see anything wrong with it. It won't work in the code playground though. You are most likely going to need multiple inputs and the code playground here doesn't handle input within a loop well. Try compiling it yourself on your pc
29th Mar 2023, 8:34 PM
Bob
0
Design Item class having ltem-Code, Name, Price, 20 and Stock in hand as data member. Add appropriate member functions. Write a Java program that accepts details of N Item and display items details in ascending order of their stock. Can anyone slove this in java
31st Mar 2023, 9:32 AM
Smita Subudhi