I take in a string (e.g. 3 6) the string will always be two one digit numbers separated by one space. I have access to the first number, but for some reason I loose access to the second one.
I tried print the second number specifically, but it printed nothing.
#include
#include
int main() {
std::string firstL;
std::cin>>firstL;
// prints 3
std::cout<<firstL[0];
// does not print anything
std::cout<<firstL[2];
// prints only three
std::cout<<firstL;
return 0;
}
New contributor
ahhle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.