I try to get in the response the variable t2 not as an int type, but as a float . Those. Now when I enter the number 457 , I have number two = 5 , and I want to get 5.7 . The code is already with an example, as I try to do, but it still outputs without tenths. What am I doing wrong?
int e, n; float s, t2; cout << "vvedite n\n"; cin >> n; s = float(n) / 100 ; // первая цифра t2 = float ((n / 10) % 10); // вторая цифра e = n % 10; // третья цифра cout << "number one = " << float(s) << endl; cout << "number two = " << float(t2) << endl; cout << "number fri = " << e << endl;