lol no worries. all I know about variables is that it's a memory location. I'm on chapter 1 of this book and my teacher hasn't taught us anything yet. Last week was just orientation and somehow I'm supposed to write these programs. I wrote 3 already, this is the only one I'm having trouble with.
Yes you would. You use cin to get input, and cout to output. For example:
1 2 3 4 5 6 7
int n = 9; //n initialized to 9
std::cin >> n; //Now the user will be prompted to provide input
//Let's say you type in 37 for the input
std::cout << n; //Now the value stored in n will be outputted to your terminal.
//Note the different operators here. << is the insertion operation, while >> is the extraction operator. In C days these meant something entirely different, but C++ offers something called operator overloaded. Don't worry about any of that right now, just keep in
//mind that to output you will use << and to get input you will use >>
You got it. Except int c = x; doesn't make sense unless x is already declared and initialized somewhere as an int. In this situation you could just write int c; and then cin >> c; like you have.
I wrote this on my phone, so forgive any typos/seeming lack of effort.
I'm still not understanding something. How do I change the value so it comes up as an 'x' without typing a hardcoded x. and now it won't run on the output :/