Hi after seen your post i had to also try this and it took me ages to figure it out.
I couldn't do it with the modulas operator so can someone show me how?
Maybe just an example?
My code is here and it works but it is horrible.
Code:
#include <iostream>
using namespace std;
int main()
{
int number,
first,
second = 0,
realsecond = 0,
third = 0,
realthird = 0,
actualthird = 0,
forth = 0,
realforth = 0,
fifth = 0,
sixth = 0,
realsixth = 0,
seventh = 0;
cout << "Input a 5 digit number: " << endl;
cin >> number; // 23456 was entered
first = number / 10000;
cout << "first\t " << first << endl; // just to understand it :)
//--------------------------------------------------------------
second = 10000 * first; // 20000
cout << "second\t " << second << endl;
realsecond = number - second;
cout << "third\t " << realsecond << endl; // 3456
third = realsecond / 1000; // 3
cout << "forth\t\t " << third << endl;
//----------------------------------------------------
realthird = 1000 * third; // 3000
actualthird = realsecond - realthird;
cout << "fifth\t " << actualthird << endl; // 456
forth = actualthird / 100; // 456
cout << "sixth\t\t " << forth << endl;
fifth = 100 * forth; // 400
realforth = actualthird - fifth;
cout << "seventh\t " << realforth << endl; // 56
realsixth = realforth / 10;
cout << "2nd last number\t\t " << realsixth << endl;
seventh = realforth % 10;
cout << "\t\t " << seventh << endl;
return 0;
}