cout<<"Please enter your 3 digit number"<<endl;
cin>>hundreds>>tens>>ones;
static_cast<int>(hundreds);
static_cast<int>(tens);
static_cast<int>(ones);
cout<<"The last number you entered is: "<<endl;
cout<<hundreds%10<<endl;
//to display the last number and then i continued in a smilar way, however im getting incorrect results.When I'm entering 345,im getting 3 instead of 5 for the last number! please help!
}
#include <iostream>
usingnamespace std;
int main()
{
char hundreds;
char tens;
char ones;
cout<<"Please enter your 3 digit number"<<endl;
cin>>hundreds>>tens>>ones;
static_cast<int>(hundreds);
static_cast<int>(tens);
static_cast<int>(ones);
cout<<"The last number you entered is: "<<endl;
cout<<ones<<endl;
}