Untitled
unknown
plain_text
3 years ago
1.5 kB
8
Indexable
#include <iostream>
#include <string>
using namespace std;
class File {
private:
string Name;
string Date;
string Time;
public:
int Size;
File( int Size, string Name, string Date, string Time) //Конструктор
{
this->Size = Size;
this->Name = Name;
this->Date = Date;
this->Time = Time;
}
void SetName(string NewName)
{
Name = NewName;
};
string GetName()
{
return Name;
}
void SetSize(int NewSize)
{
Size = NewSize;
};
int GetSize()
{
return Size;
}
void SetDate(string NewDate)
{
Date = NewDate;
};
string GetDate()
{
return Date;
}
void SetTime(string NewTime)
{
Time = NewTime;
};
string GetTime()
{
return Time;
}
~File() = default; //Деструктор
};
class Catalog: private File {
public:
bool sCheck(int s) //Метод
{
return (s == Size);
}
};
int main()
{
File A;
A.SetName("Photos");
A.SetSize(12);
A.SetDate("16.08.2022");
A.SetTime("18:00");
int s;
cout << "*Перевірка файлу за розміром*" << endl << endl;
cout << "Введіть розмір файлу: ";
cin >> s;
if (sCheck(s))
cout << endl << "Існує файл А такого розміру." << endl;
else
cout << endl << "Не існує файлу такого розміру." << endl;
return 0;
}Editor is loading...