Hello.I can't understand why when I call function in if statement is not the same as without if.Thanks in adavnce : Why when I call function inside of the if statement the result is like " please enter phone number: please enter your name: in the same line" but I need like the first "please enter your phone number: 4545 in the next line please enter your name: dddf

    #include <iostream>
    
    using namespace std;
    
    void insert_data ()
    {
        string phone_number[10] = {};
        string name[10] = {};
        
        int count = 0;
        for(int i = 0; i < 10; i++ ){
            if(name[i] != "" ){
                count++;
            }
        }
        
        cout<< "please enter phone number: ";
        string new_phone_number;
        getline (cin, new_phone_number);
        phone_number[count] = new_phone_number;
        
        cout<< "please enter your name: ";
        string new_name;
        getline (cin, new_name);
        name[count] = new_name;
    
        count++;
    }
    
    int main()
    {
        string a;
        cin>> a;
        if(a == 1){
            insert_data();
        }
    
    }

