+ 1
How can I use the first digit of the number which has 2 or more digits?
For example I have the number 324 and I want to use the second digit of that(number 2)
8 Antworten
+ 2
First of all, what language are you using, please include it in the tags intead of '.'
+ 1
Sorry I forgot it
I am using c++
+ 1
Thank you for the other question
But in this I want it as an int
+ 1
Your question asks for how to get the first digit of a number. But in your Description you wrote that you want the second digit. Which one are you asking for? or maybe you want to use any of the digit at random position?
+ 1
Thank you
0
better choise is to read the number as a string.
string nb[10];
cout << “put some number”;
cin >> nb;
cout << nb[1]; /*index 1 it mean the second number.*/