Advertisement
35657

Untitled

May 18th, 2024
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2.  
  3. #include <iostream>
  4. #include <string>
  5. #include <fstream>
  6. #include <Windows.h>
  7.  
  8. using namespace std;
  9.  
  10. int main() {
  11.     SetConsoleCP(1251);
  12.     SetConsoleOutputCP(1251);
  13.  
  14.     ofstream fout;
  15.  
  16.     fout.open("C:/Users/PC/Documents/student.txt");
  17.  
  18.     if (!fout.is_open()) {
  19.         cout << "Ошибка открытия файла" << endl;
  20.     }
  21.     else {
  22.         string str;
  23.         cout << "Введите фамилию: ";
  24.         cin >> str;
  25.         fout << str << endl;
  26.         cout << "Введите имя: ";
  27.         cin >> str;
  28.         fout << str << endl;
  29.         cout << "Введите номер зачетной книжки: ";
  30.         cin >> str;
  31.         fout << str << endl;
  32.         fout.close();
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement