Skip to content

Instantly share code, notes, and snippets.

#include "Utils.h"
#include "iostream"
using namespace std;
bool Utils::isValid(string &str) {
for (auto it = str.cbegin(); it != str.cend(); it++)
if (!isdigit(*it) && (it != str.cbegin() || *it != '-' || str.length() == 1))
return false;
return !str.empty();
#ifndef KURSACHNEW_UTILS_H
#define KURSACHNEW_UTILS_H
#include <string>
#include "FileUtil.h"
#include "Date.h"
using namespace std;
#include <iostream>
#include <Windows.h>
#include "Utils.h"
using namespace std;
int main () {
SetConsoleOutputCP(1251);
SetConsoleCP(1251);
setlocale(LC_ALL, "Russian");
#include "FileUtil.h"
#include "Date.h"
#include "Utils.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
struct Session{
//
// Created by Delta on 18.05.2020.
//
#ifndef KURSACHNEW_FILEUTIL_H
#define KURSACHNEW_FILEUTIL_H
class FileUtil {
#include "Date.h"
#include "Utils.h"
#include <string>
using namespace std;
Date::Date() {
this->day = 0;
this->mon = 0;
this->year = 0;
}
#ifndef KURSACHNEW_DATE_H
#define KURSACHNEW_DATE_H
#include <string>
using namespace std;
class Date {
public:
Date(); //Конструктор класса
int day = 0, mon = 0, year = 0; //Стандартные значения
static int isValid(int, int, int); // Проверка даты на валидность. День, месяц, год
D:\KursachNEw\cmake-build-debug\KursachNEw.exe
Введите номер действия:
1. Добавить студентов.
2. Удалить студента.
3. Список всех студентов.
4. Изменить информацию о студенте.
5. Отсортировать.
0. Выход.
1
ММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММ
void FileUtil::test() {
FILE *file2;
file2 = fopen("person.dat", "r+");
//Сделать нормальный счёт
int n = 1;
for(int i = 0; i < n; i++) {
struct student output1;
fread(&output1, sizeof(struct student), 1, file2);
cout << output1.sessions[0].subj[0] << endl;
void FileUtil::enterStudent(){
struct student stud;
string fa, name, ot, fio, date, kaf, group;
cout << "Введите Фамилию." << endl;
getline(cin, fa);
fio.append(fa);
cout << "Введите Имя." << endl;
getline(cin, name);
fio.append(" " + name);
cout << "Введите Отчество." << endl;