CodePudding user response:
For exampleint main (int arg c, const char * argv []) {
TMP char buf [21], [11];
int len;
The fgets (buf, sizeof (buf), stdin);
Len=(int) strlen (buf);
If (buf [len - 1]=='\ n') {
Buf [len -]='\ 0';
}
Len/=2;
Strncpy (TMP, buf, len);
Printf (" % s % s ", TMP, buf + len);
return 0;
}
CodePudding user response:
In c + +/2 directly is short after long before the break up,CodePudding user response:
CodePudding user response:
#include
#include
using namespace std;
Int main () {
String STR.
Cin & gt;> str;
Auto mid=STR. The begin () + STR. The length ()/2;
String s1 (STR. The begin (), mid);
String s2 (mids, STR. End ());
Cout & lt;
return 0;
}
/*
Run
Abcdefg
ABC, defg
*/