#include <iostream>
#include <string>
int main() {
char s2;
s2 = '1' - '0';
std::cout << s2;
std::cout << std::endl;
std::cout << '1' - '0';
std::cin >> s2;
}
The output produced is:
☺
1
My question is, why are the two lines different? I expected and wanted both results to be 1
. By my understanding they should be the same but that is obviously wrong, could somebody please explain this to me? Thank you