Okay, I keep getting an error stating that I have few arguments in my void function. I changed it so many time with different combination and yet I still get this error. I just simply want the program to print each digit in a vertical line.
#include <iostream>
#include <cmath>
using namespace std;
void vertical(int &a, int digit[]);
int main () {
int a;
cout << "Please enter a 4 digit number" << endl;
cin >>a;
while( a>999 && a<10000) {
vertical(a);
cout << "Please enter a 4 digit number" << endl;
cin >> a;
}
return 0;
}
void vertical(int &a, int digit[]) {
for (int i = 0; i < 4; i++){
digit[i] = a % 10;
a = a/10;
}
cout << digit[0] << endl;
cout << digit[1] << endl;
cout << digit[2] << endl;
cout << digit[3] << endl;
}