#include <iostream>//Input output stream
using namespace std;
//implement function wich get 5 number(array) and return number
int DigitToNum(int ar[5])
{
int ans= 0;
//1 2 3 4 5=0*10+1=1->1*10+2=12->12*10+3=123->123*10+.... (use this)
for (int i = 0; i < 5; i++)
ans = (ans * 10) + ar[i];
return ans;
}
int main()
{
cout << "Please enter 5 single number(digit)\n";
int ar[5];
for (int i = 0; i < 5; i++)
cin >> ar[i];//Scaner each digit
int number = DigitToNum(ar);//return num
//Output this number
cout << number << endl;
return 0;
//Input test
//Please enter 5 single number(digit)
//4 8 5 2 3
//Output
//48523
}
Comments
Leave a comment