I'm rather confused at what exactly the difference is between
the different variable types, mainly int and char.
At first I trying changing the code that was given in the tutorial involving, and it worked. So instead of numbers I thought, how about letters?
I assume Char (meaning character) is used for letters.. yet when I changed it up it just didnt work.
So then I went back to numbers and tried to make it so you could only type in numbers, not letters. The tutorial used cin.ignore(); for the program to ignore the enter key being a response to the question "Please enter a number".
Basicly what I want to know is how did it know cin.ignore means the "enter" key and how can I change it to add multiple other characters to the "ignore list"?
Sorry if that was a bit confusing, im not the best at explaining things.Code:#include <iostream> using namespace std; int main() { int omgnumbers; cout<<"Please Enter a number: "; cin>> omgnumbers; cin.ignore(); cout<<"You Entered:"<< omgnumbers; cin.get(); }
oh and I cant wait to meet you all! This is my first post here.