Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

ConsoleApplication1 / ConsoleApplication1 / ConsoleApplication1

.cpp
Скачиваний:
1
Добавлен:
10.04.2019
Размер:
3.39 Кб
Скачать
яю#include "stdafx.h"

#include <cstring>

#include <iostream>

#include <iomanip>



using namespace std;

class A

{

	int begin;

	int end;

	char task[50];

public:

	void Set(int _begin, int _end, char* _task)

	{

		begin = _begin;

		end = _end;

		strcpy_s(task, _task);

	}

	int getBegin()

	{

		return begin;

	}

	int getEnd()

	{

		return end;

	}

	char* getTask()

	{

		return task;

	}

};

ostream &setup(ostream &stream)

{

	cout.width(2);

	cout.fill('0');

	return stream;

}

int _tmain(int argc, _TCHAR* argv[])

{

	setlocale(0, "Russian");

	A staff[100];

	int staffCNT = 0;

	char exit = 'y';

	int hb = 0, mb = 0, he = 0, me = 0;

	char name[50];

	while (exit == 'y')

	{

		cout << endl << "2548B5 2@5<O =0G0;0 7040G8, @0745;OO G0AK 8 <8=CBK ?@>1;5;><" << endl;

		cin >> hb >> mb;

		cout << endl << "2548B5 2@5<O :>=F0 7040G8, @0745;OO G0AK 8 <8=CBK ?@>1;5;><" << endl;

		cin >> he >> me;

		cout << endl << "2548B5 =0720=85 7040G8" << endl;

		cin >> name;

		staff[staffCNT].Set(hb * 60 + mb, he * 60 + me, name);

		staffCNT++;

		cout << endl << "25AB8 5IQ >4=C 7040GC? (y/n) ";

		cin >> exit;

		cout << endl;

	}

	int pr = 45;

	for (int i = 420; i < 1380; i += pr)

	{

		cout << setup << (i / 60) << ":" << setup << i % 60 << " - " << setup << (i + pr - 1) / 60 << ":" << setup << (i + pr - 1) % 60;

		for (int j = 0; j < staffCNT; j++)

		{

			if ((staff[j].getBegin()>i && staff[j].getBegin()<(i + pr - 1))

				|| (staff[j].getEnd()>i && staff[j].getEnd()<(i + pr - 1))

				|| (staff[j].getBegin()<i && staff[j].getEnd()>(i + pr - 1)))

			{

				cout << "*";

				break;

			}

		}

		cout << endl;

	}

	system("pause");

	return 0;

}

Соседние файлы в папке ConsoleApplication1