This program selects a random number between 1 and 100 and the used need to guess it. Once they guess it, the program will display the number of attempts the user had.
For this you should remember random and not to name your file random because then the program gets confused and it will import itself so it wont work. With the function WHILE im able to make a loop which wont let the user to finish until he/she guess the number. and with the conditionals im […]
#include <iostream> #include <ctime> #include <cstdlib> using namespace std; int main() { int a; srand (time (NULL)); int x = rand () % 101; cout << “te doy un número del 0 al 100 adivinalo” << endl; cin >> a; while (a!=x) { if (a<x) { cout << “muy alto, intentalo de nuevo” << endl;…
So this one is a little bit more simple than the last one. The program chooses a number randomly and asks the user to guess the number. When the user finally gets it, it tells him or her how many tries did it take. Simple, right? Well not going t lie, I did have my […]
Ok, this is officially the hardest wsq that I’ve done so far, it took me around a day or two to finally complete my code, I had to check others codes at first, then I went with a couple of friends from older semesters to check out if they could help me out. They couldn’t. … Continue reading #WSQ06 →
Guess! This WSQ is about a program that picks a number from 1 to 100 and then asks the user to guess the number. The program must give clues like “Too high or too low”. At the end the program prints how many times you tried. Here is my code: I had to do some […]
Hi there people. This task was a little different, because you had to use another library, and some different functions. The library <ctime> or <time.h> which is the same, is used here to measure time, so you can generate a… Continue Reading →
I was asked to create a game that makes you guess a number between 1 and 100. So I had thes keypoints: If it inputs a lower number let know the user it If it inputs a biggernumber let know the user it Say in … Continúa leyendo Pickanumber WSQ06
I was asked to create a game that makes you guess a number between 1 and 100. So I had thes keypoints: If it inputs a lower number let know the user it If it inputs a biggernumber let know… Continue Reading →
This homework was very interesting mostly because i had some trouble importing the random module
until my good teacher Ken help me, after that i only used a simple while loop with a counter.
Tip: if you have any problems ask ken its really helpful.