+ 1

I need to make an programm which prints out the given digit of a given number

Example: input: m=2345 n=3 output: 5 also the programm should repeat itself. I got the most so far but i dont know how i can print out the fourth (5) number of m. Thank you guys

17th Oct 2019, 8:23 AM
Yippiekayo Romeo
Yippiekayo Romeo - avatar
4 ответов
+ 5
It would be helpful if you show us the code you have done so far.
17th Oct 2019, 8:39 AM
Lothar
Lothar - avatar
+ 1
#include<iostream> #include<cmath> using namespace std; int main() { bool run {true}; while (run) { double m{0},n{0}; cout<< "Type in number= "; cin>> m; cout<< "Digit of the number?= "; cin>> n; //Give out Digit(n) of the number(m); char answer; cout<< "Run Programm again? [y/n]: "; cin>> answer; run = answer == 'y'; } return 0; }
17th Oct 2019, 11:00 AM
Yippiekayo Romeo
Yippiekayo Romeo - avatar
+ 1
I dont think we use arrays yet we just learned loops.
17th Oct 2019, 11:01 AM
Yippiekayo Romeo
Yippiekayo Romeo - avatar