This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef KURSACHNEW_UTILS_H | |
#define KURSACHNEW_UTILS_H | |
#include <string> | |
#include "FileUtil.h" | |
#include "Date.h" | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <Windows.h> | |
#include "Utils.h" | |
using namespace std; | |
int main () { | |
SetConsoleOutputCP(1251); | |
SetConsoleCP(1251); | |
setlocale(LC_ALL, "Russian"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "FileUtil.h" | |
#include "Date.h" | |
#include "Utils.h" | |
#include <iostream> | |
#include <fstream> | |
#include <string> | |
using namespace std; | |
struct Session{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by Delta on 18.05.2020. | |
// | |
#ifndef KURSACHNEW_FILEUTIL_H | |
#define KURSACHNEW_FILEUTIL_H | |
class FileUtil { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Date.h" | |
#include "Utils.h" | |
#include <string> | |
using namespace std; | |
Date::Date() { | |
this->day = 0; | |
this->mon = 0; | |
this->year = 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); // Проверка даты на валидность. День, месяц, год |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
D:\KursachNEw\cmake-build-debug\KursachNEw.exe | |
Введите номер действия: | |
1. Добавить студентов. | |
2. Удалить студента. | |
3. Список всех студентов. | |
4. Изменить информацию о студенте. | |
5. Отсортировать. | |
0. Выход. | |
1 | |
ММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММММ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
NewerOlder