Advertisement
Guest User

Untitled

a guest
Dec 11th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <cstdio>
  3. #include <conio.h>
  4. #include <iostream>
  5. using namespace std;
  6. int main() {
  7. int symbols, limiter;
  8. char s1[400],s2[400],s3[400];
  9. cout << "Enter words \n";
  10. gets_s(s1);
  11. symbols = strlen(s1);
  12. cout << "\nThe number of characters=" << symbols;
  13. cout << "\nEnter the position of symbol after which we divide the line(k)" << endl;//k=limiter
  14. cin >> limiter;
  15. if (s1[limiter]!=' ') {
  16. limiter -= 1;
  17. }
  18. strncpy_s(s2, s1, limiter);
  19. cout << "\nFirst half" << endl;
  20. cout << s2;
  21. cout << "\nSecond half" << endl;
  22. _strrev(s1);
  23. strcpy_s(s2, s1);
  24. int limiter2 = symbols - limiter;
  25. strncpy_s(s3, s2, limiter2);
  26. _strrev(s3);
  27. cout << s3;
  28. cout << "\nEnter any key for exit...";
  29. _getch();
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement