Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <cstring>
- #include <math.h>
- #include <cstdlib>
- #include <fstream>
- #include <windows.h>
- using namespace std;
- int main()
- {
- int j, k=1;
- string str = "", str1, str2, str3;
- setlocale(LC_ALL, "Rus");
- ofstream text;
- char arr[15];
- while (k == 1)
- {
- j = 0;
- cout << "Введите имя файла (после ввода названия нажмите * и Enter): " << endl;
- for (int i = 0; i < 15; i++)
- {
- cin >> arr[i];
- if (arr[i] != '*')
- {
- j++;
- }
- else if (arr[i] == '*')
- {
- break;
- }
- }
- k = 2;
- for (int i = 0; i < j; i++)
- {
- if (arr[i] >= (char)97 && arr[i] <= (char)122 || arr[i] == (char)46) { }
- else
- {
- cout << "Имя файла введено некоректно. Введите заново" << endl;
- k = 1;
- break;
- }
- }
- }
- for (int i = 0; i < j; i++)
- {
- str += arr[i];
- }
- text.open(str);
- cout << "Введите 1-ю строку:";
- cin >> str1;
- cout << "Введите 2-ю строку:";
- cin >> str2;
- cout << "Введите 3-ю строку:";
- cin >> str3;
- text << str1 << endl << str2 << endl << str3 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement