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