Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <cstdio>
- #include <conio.h>
- #include <iostream>
- using namespace std;
- int main() {
- int symbols, limiter;
- char s1[400],s2[400],s3[400];
- cout << "Enter words \n";
- gets_s(s1);
- symbols = strlen(s1);
- cout << "\nThe number of characters=" << symbols;
- cout << "\nEnter the position of symbol after which we divide the line(k)" << endl;//k=limiter
- cin >> limiter;
- if (s1[limiter]!=' ') {
- limiter -= 1;
- }
- strncpy_s(s2, s1, limiter);
- cout << "\nFirst half" << endl;
- cout << s2;
- cout << "\nSecond half" << endl;
- _strrev(s1);
- strcpy_s(s2, s1);
- int limiter2 = symbols - limiter;
- strncpy_s(s3, s2, limiter2);
- _strrev(s3);
- cout << s3;
- cout << "\nEnter any key for exit...";
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement