Section 02, Lecture 21 Solution

Just my solution to the get input/return input challenge in S2L21

Code:

#include <iostream>
#include <string>

int main() {
    //Introduce the game
    constexpr int WORD_LENGTH = 5;

    std::cout << "Welcome to Bulls and Cows, a fun word game!" << std::endl;
    std::cout << "Can you guess the " << WORD_LENGTH <<" letter isogram I'm thinking of?" << std::endl;

    //Get a guess from the user
    std::string str_player_guess = "";
    std::cout << "Please enter a guess: ";
    std::cin >> str_player_guess;
    
    //Repeat gues back to user
    std::cout << "Your guess was: " << str_player_guess << std::endl;

    return 0;
}

here is my solution pics…

this is getting easier and easier…

I wish I had gotten into this much earlier in life… but I was always a console person so instead of saving up to buy a decent computer, I always bought a video game system and games for that system… since the day after I’ve started this class, my Xbox one hasn’t been on for more than a couple hours total…

Privacy & Terms