输入:
连续输入字符串(输入2次,每个字符串长度小于100)
输出:
输出到长度为8的新字符串数组
样例输入:
abc
123456789
样例输出:
abc00000
12345678
90000000
#include <iostream>
#include <string>
using namespace std;
int main( void )
{
int i = 2;
string line;
while( i-- ){
getline( cin, line );
int nLen = line.length();
int nLenApp = nLen / 8 * 8 + 8;
for( int j = 0; j < nLenApp; ++j ){
if( j % 8 == 0 && j > 0 )
cout << endl;
if( j < nLen )
cout << line[j];
else
cout << '0';
}
cout << endl;
}
return 0;
}