Terminal input for players

How did you find working with cin? Do you run into any issues with it?

cin and cout is not something we will be doing a lot when we switch over to Unreal. But I wanted to give you an idea of some of the issues we can run into when we work with it and when it fails.

Later on, we’ll be covering how to fix any potential issues we may run into when it fails.

I’ve found that my only real problem is that sometimes I forget to put a space between each number in the guess and then press enter to find that I’ve messed up.

I often forget to include std:: . In my previous attempts to learn to code I’m so used to including the standard namespace at the top! But I understand we do it this way to avoid possible namespace conflicts

cin is a very useful tool. Concerning the coursework, no I had no problems with the code. I did have an issue when I was doing my own thing outside the coursework. I have some prior C and C++ experience and have put a lot of the code into their own functions. When I made a function for when you guess the wrong answer for the code, there was an issue with getting backslash () to print. A simple google and I discovered that in order for a backslash () to be printed, you must put two backslashes together inside the quotations (\). This tells the compiler to print the backslash ().

1 Like

I’m not quite understand, mani() returns 0, why it returns the number that you putted in? As in python, def returns the variable that follow the return keywords.

cin is incredibly confusing to me–I don’t quite understand why it does what it does but I’m glad it works X3 I might rewatch this lesson a few times.

image

1 Like

image

Not really sure why mine is outputting strange values.

***Never mind. While I don’t yet understand why it caused such a large value to be returned, I have two:
std::cin>> GuessB;'s in a row