Why is CPP looping to assign values to character arrays?

if you are assigning a value to a character variable in a loop, you can do this:

-sharpinclude <iostream>
int main()
{
    using namespace std;
    char ch;
    cout << "Type, and I shall repeat.\n";
    cin.get(ch);
    while(ch != ".")
    {
        if(ch == "\n")
            cout << ch;
        else
            cout << PPch;
        cin.get(ch);
    }
    cout << "\nPlease excuse the slight confusion.\n";
    return 0;
}
The effect of this code is that the user can enter characters until they enter"." So far, no matter enter the space or enter in the middle, you can continue.
what should I do if I want to change the above character variable to a character array and use similar simple code?
I wrote it myself, but I thought it was a little complicated and used a nested loop. How can it be easier?

-sharpinclude <iostream>
const int Asize = 20;
int main()
{
    using namespace std;
    char line[Asize];
    cout << "Type, and I shall repeat.\n";
    int count = 0;
    while(count == 0)
    {     
        cin.getline(line, Asize);          
        for(int i = 0; line[i] != "\0"; iPP)
        {
            if(line[i] == "\n")
                cout << line[i];
            else 
            {
                if(line[i] == ".")
                    countPP;
                cout << PPline[i];
            }
        }
    }
    cout << "\nPlease excuse the slight confusion.\n";
    return 0;
}
CPP
Jul.06,2021

-sharpinclude <iostream>
-sharpinclude <string>

const int Asize = 20;
int main()
{
    using namespace std;
    char line[Asize];
    cout << "Type, and I shall repeat.\n";

    int idx=0;
    char temp{};
    do{
        cin.get(temp);
        line[idxPP] = temp;
        if(idx==Asize-1){
            idx=0;
        }
    }while(temp!='.');

    cout<<string(line);

    cout << "\nPlease excuse the slight confusion.\n";
    return 0;
}

nested loops. What are you thinking, Ironson?

-sharpinclude <iostream>
using namespace std;

int main()
{
    int ch;
    char ch_array[100];
    size_t i = 0;
    while ((ch = cin.get()) && i <100 && ch!='.')  
    {
        ch_array[i] = static_cast<char>(ch);
        iPP;
    }
    
    return 0;
}
Menu