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) {

        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;

Look at the function prototype on line 7, it has two arguments. Now look at line 16, it is passing only one argument. The compiler is complaining because line 16 is not passing enough arguments. In main() declare an array of ints and add that array as the second argument on line 16.

The function that starts on line 24 is going to have problems. The first parameter, variable named "a" is a pointer, but you are using it inside the function as if it is not a pointer. It can't be both ways. I'd suggest you remove the pointer & opeator on both lines 7 and 24 because the function does not need a pointer for that variable.

Suggestion: you don't need both lines 12 & 13, and 17&18. Rearrange main() so that lines 17 & 18 appear only once in your program. You should find ways to eliminate repeated code in your programs.