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

Sem4 / Sem4 / Text

.cpp
Скачиваний:
0
Добавлен:
10.04.2019
Размер:
825 б
Скачать
#include "stdafx.h"
#include "Text.h"
#include <cmath>
#include <iostream>

using namespace std;

Text::Text()
{
	number_sym = 0;
	h_sym = 0;
	line_space = 0;
	h_text = 0;
}

int Text::Set(int n, double h, double l, Base b)
{
	number_sym = n;
	h_sym = h;
	line_space = l;
	return TextHeight(b);
}

int Text::TextHeight(Base b)
{
	int n_str;
	n_str = ceil(number_sym*h_sym / b.GetL());							//кол-во строк
	h_text = n_str * h_sym + (n_str - 1) * line_space;					//высота текста
	cout << "Text height: " << h_text << endl;
	if (b.GetOstH() >= h_text)
	{
		cout << "This text can be placed in this document\n";
		return 0;
	}
	else
	{
		cout << "This text can not be placed in this document\n";
		return -1;
	}
}

double Text::GetH_Text()
{
	return h_text;
}

Text::~Text()
{
}
Соседние файлы в папке Sem4