The first part of the answer is on the first line of your code.
char a;
Variable a
is a single char
, an 8-bit value typically used to store a code representing a display character. If the display is ASCII, then (value) 0 = no character, (value) 32 = space, value 48 = (character) '0', etc.
std::cin
is an instance of class std::istream
, it has various members and operator overloads to deal with different types. In the case of a char
, you are calling
std::istream::operator(char)
Which reads one char
, exactly one, from the input stream and returns.
#include <iostream>
int main()
{
char a, b, c;
std::cin >> a >> b >> c;
std::cout << "a = " << a << ", b = " << b << ", c = " << c << '\n';
return 0;
}