Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <ctype.h>
- using namespace std;
- bool islatin(char c) {
- if (c > (char)96 && c < (char)123)
- return true;
- else
- return false;
- }
- int main()
- {
- setlocale(LC_ALL, "rus");
- string name = "";
- string h;
- char input;
- while (cin >> input && input != '=') //EOF - Ctrl + Z
- { //сделать нормальный перевод на новую строчку
- // \n, endl, так далее
- try
- {
- if (!islatin(input) || isdigit(input) || isupper(input))
- {
- throw 1;
- }
- name += input;
- }
- catch (int i)
- {
- cout << "Введите имя заново. \n";
- }
- }
- ofstream fout;
- fout.open(name.c_str());
- cout << "Введите хокку. \n";
- cin.get();
- //getline(cin, h);
- cin >> h;
- cout << h;
- fout << h << "\n";
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement