Advertisement
35657

Untitled

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