Title Description

• Continuous input string , Please press the length of 8 Split each string and output to a new string array ;
• Length is not 8 Please fill in the number after the integer times string 0, Empty string does not process .

Enter a description :

Continuous input string ( input 2 second , Each string is less than 100)

Output description :

Output to length 8 New string array for

Input example :
abc 123456789

Output example :
abc00000 12345678
90000000

#include<iostream> #include<string> using namespace std; void coutl(int n) {
for (int i = 0; i < n; i++) cout << 0; cout << endl; } void couts(string s) {
if (s == "")return; int n = s.size() / 8; int y = s.size() % 8; if (n >= 1) {
for (int i = 0; i < n; i++) cout << s.substr(8 * i, 8) << endl; cout <<
s.substr(8 * n, y); coutl(8 - y); } else { cout << s; coutl(8 - y); } } int
main() { string s,s1; while (getline(cin, s)) { getline(cin,s1); couts(s);
couts(s1); } return 0; }

Title Description

Continuous input string ( Output times are N, String length less than 100), Please press the length of 8 Split each string and output to a new string array ,

Length is not 8 Please fill in the number after the integer times string 0, Empty string does not process .

Enter an integer first , Number of strings to enter .

for example :

input :2

      abc

      12345789

output :abc00000

      12345678

      90000000

The interface function is designed as follows :

/*****************************************************************************
function : Store character creation of input

input : character string

output : nothing
    
return :0 Indicates success , Other return -1
******************************************************************************/

int  AddString(char *strValue);
/****************************************************************************
function : Get the length of two-dimensional array after complement

input : nothing

output : nothing
    
return : Two dimensional array length
*****************************************************************************/

int  GetLength();

/*****************************************************************************
function : Two dimensional array after filling , Compare with the input 2D array

input :strInput: Input 2D array ,iLen: Length of the input 2D array

output : nothing
    
return : If equal , return 0; Unequal , return -1. other :-1;
******************************************************************************/
int  ArrCmp(char strInput[][9],int iLen);

 

Enter a description :

Enter number first n, Indicates how many strings to enter . Continuous input string ( Output times are N, String length less than 100).

Output description :

By length 8 Split each string and output to a new string array , Length is not 8 Please fill in the number after the integer times string 0, Empty string does not process .

Input example :
2 abc 123456789

Output example :
abc00000 12345678 90000000

#include <iostream> #include <string> using namespace std; int main() { int
num; while (cin >> num) { cin.get(); while (num--) { string s; getline(cin, s);
while (s.size() / 8) { cout << s.substr(0, 8) << endl; s = s.substr(8); } if
(!s.empty()) { cout << s; size_t i = 8 - s.size(); while (i--) cout << '0';
cout << endl; } } } return 0; }

Technology
©2019-2020 Toolsou All rights reserved,
JAVA Detailed explanation of anomalies MySQL An interview is a must ! How to use it quickly html and css Write static page R Language cluster analysis case Dialogue between apple and Nissan suspended ,Apple Car How's it going ?java Realize the function of grabbing red packets SpringBoot practice ( five ):mybatis-plus In BaseMapper,Iservice and ServiceImpl Google says home office affects work efficiency !2021 Return to offline office in 2010 about keras use fit_generator Encountered in StopIteration Programmer Tanabata Valentine's Day confession code