Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SEQURE_NO_WARNINGS
- #include <iostream>
- #include <Windows.h> // нужна для работы SetConsole
- using namespace std;
- int main() {
- SetConsoleCP(1251); // установка кодировки в поток ввода
- SetConsoleOutputCP(1251); // установка кодировки в поток вывода
- const int size = 100;
- char line[size];
- int m, n;
- cout << "Введите строку: ";
- gets_s(line);
- cout << "Введите m: ";
- cin >> m;
- cout << "Введите n: ";
- cin >> n;
- char* result = new char[n - m + 2];
- int s = 0;
- for (int i = m; i <= n; i++) {
- result[s] = line[i];
- s++;
- }
- result[s] = '\0';
- cout << result << endl;
- delete[] result;
- }
Advertisement
Add Comment
Please, Sign In to add comment