请问如何把输出的第二三行接在一起?


#include <ctype.h>
#include <iostream>
using namespace std;

int main()
{
    char p[100];
    int n = 0;
    char a[100];
    
    while (fgets(p, sizeof(p), stdin))
    {
        char*a = p;
        
        for (int i = 0; i < strlen(p) - 1; i++)
        {
            n = n * 2 + p[i] - '0';
        }

        cout <<a<<"'s decimal is: "<<n<<endl;
    }
}

输出如图,请问如何接上第二第三行?
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/648753616436142.png "=600 #left")
 
#include <bits/stdc++.h>
using namespace std;
int main()
{
    char p[100];
    int n = 0;
    char a[100];
    while (cin>>p)
    {
        char*a = p;
        for (int i = 0; i < strlen(p) - 1; i++)
        {
            n = n * 2 + p[i] - '0';
        }
        for (int i=0;a[i]!='\0';i++)
        
            cout<<a[i];
        cout <<"'s decimal is: "<<n<<endl;
    }
}
 

img