//c++
#include <iostream>
using namespace std;
struct MyInfo {
string surname, name;
int month, day;
MyInfo(string s, string n, int m, int d) {
surname = s;
name = n;
month = m;
day = d;
}
void PrintInfo(){
cout << "Фамилия:" << surname << "\nИмя:" << name << "\nМесяц рождения:" << month << "\nДень рождения: " << day << "\nПароль:" << day + month << endl;
}
};
signed main() {
setlocale(LC_ALL, "Rus");
MyInfo I("Иванов","Иван",10, 15);
I.PrintInfo();
return 0;
}
//c++
#include <iostream>
#include <fstream>
#include <ctime>
using namespace std;
signed main() {
srand(time(NULL));
ofstream f;
ifstream fin;
try {
f.open("primer.txt");
for (int i = 0; i < 20; i++)
f << rand() % 15 << " ";
f.close();
}
catch (...) {
cout << "Error!";
}
try {
fin.open("primer.txt");
int x;
do
{
fin >> x;
cout << x % 5 << " ";
} while (!fin.eof());//пока не наступил конец файла
fin.close();
}
catch (...) {
cout << "Error!";
fin.close();
}
return 0;
}