+ 1

C++ Variable Type with input

Hi there! Im migrating from javascript to C++ and am curious as to how This works in C++: ``` #include <iostream> using namespace std; int main() { int a; cout << "Please enter a number \n"; cin >> a; return 0; } ``` I am confused about how cin gives a string to an int variable. Does C++ automatically convert it to an int? Or is there something else going on?

14th Oct 2020, 3:03 AM
WickedTree
WickedTree - avatar
1 Respuesta