Find Jobs
Hire Freelancers

cows and bulls

$10-30 USD

Ukończony
Opublikowano około 7 lat temu

$10-30 USD

Płatne przy odbiorze
Create a program that will play the "Bulls and Cows" game with the user. The game works like this: Randomly generate a 4-digit number where all four digits are unique. Ask the user to guess a 4-digit number. For every digit that the digit the user guessed correctly in the correct place, they have a "bull" (as in bullseye). For every digit the user guessed correctly in the wrong place is a "cow". Every time the user makes a guess, tell them how many "bulls" and "cows" they have. Once the user guesses the correct number, the game is over. Keep track of the number of guesses the user makes throughout the game and the time it takes to correctly guess the 4-digit number. At the end of the game tell the user how many guesses and how long it took to win. This assignment is one to give you practice with vector. You will also find yourself implementing a linear search and having a need for a nested for-loop. Populate your vector(s) with the push_back method. DO NOT use any string methods or a character array to isolate the individual digits within a user's guess or any functionality from <algorithm>. Instead use integer division and remainders to isolate the individual digits. And DO NOT use any functions from <algorithm>. BUT do feel free to use any vector member functions. Please name your submission, [login to view URL] . If I was submitting it my file would be [login to view URL] . All text produced by your program should have a format identical to what is shown below. Here is a sample run, where the program picked 9736: Enter a 4 digit number(unique digits): 0987 bulls = 0 and cows = 2 Enter a 4 digit number(unique digits): 9078 bulls = 1 and cows = 1 Enter a 4 digit number(unique digits): 9780 bulls = 2 and cows = 0 Enter a 4 digit number(unique digits): 9580 bulls = 1 and cows = 0 Enter a 4 digit number(unique digits): 9740 bulls = 2 and cows = 0 Enter a 4 digit number(unique digits): 9721 bulls = 2 and cows = 0 Enter a 4 digit number(unique digits): 9768 bulls = 2 and cows = 1 Enter a 4 digit number(unique digits): 9785 bulls = 2 and cows = 0 Enter a 4 digit number(unique digits): 9756 bulls = 3 and cows = 0 Enter a 4 digit number(unique digits): 9706 bulls = 3 and cows = 0 Enter a 4 digit number(unique digits): 9716 bulls = 3 and cows = 0 Enter a 4 digit number(unique digits): 9726 bulls = 3 and cows = 0 Enter a 4 digit number(unique digits): 9736 bulls = 4 and cows = 0 You guessed it in 13 tries, taking 2 minutes and 49 seconds
Identyfikator projektu: 13390891

Informację o projekcie

5 ofert
Zdalny projekt
Aktywny 7 lat temu

Szukasz sposobu na zarobienie pieniędzy?

Korzyści ze składania ofert na Freelancer.com

Ustal budżet i ramy czasowe
Otrzymuj wynagrodzenie za swoją pracę
Przedstaw swoją propozycję
Rejestracja i składanie ofert jest bezpłatne
Przyznano:
Awatar Użytkownika
$20 USD w 1 dzień
4,6 (3 opinii)
1,3
1,3
5 freelancerzy składają oferty o średniej wysokości $34 USD dla tej pracy
Awatar Użytkownika
I can do it easy!
$30 USD w 1 dzień
5,0 (29 opinii)
5,0
5,0
Awatar Użytkownika
Hi sir...!! I read your description and will do that task just in a hours. I am professional C/C++ developer and have developed many applications so please contact me before awarding someone else. Thank you...!!!
$20 USD w 1 dzień
5,0 (28 opinii)
4,5
4,5
Awatar Użytkownika
A proposal has not yet been provided
$25 USD w 1 dzień
4,8 (2 opinii)
3,5
3,5

O kliencie

Flaga UNITED STATES
New York, United States
5,0
1
Zweryfikowana metoda płatności
Członek od lut 28, 2017

Weryfikacja Klienta

Dziękujemy! Przesłaliśmy Ci e-mailem link do odebrania darmowego bonusu.
Coś poszło nie tak podczas wysyłania wiadomości e-mail. Proszę spróbować ponownie.
Zarejestrowani Użytkownicy Całkowita Liczba Opublikowanych Projektów
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Wczytywanie podglądu
Udzielono pozwolenia na Geolokalizację.
Twoja sesja logowania wygasła i zostałeś wylogowany. Proszę, zalogować się ponownie.