#include <iostream>
using namespace std;
class Building {
private:
string adress_m;
int storeyCount_m;
bool quarantine_m;
public:
Building(string adress = "", int count = -1) {
adress_m = adress;
storeyCount_m = count;
}
void addStoreys(int count) {
storeyCount_m += count;
}
void quarantineOn() {
cout << "Quarantine: on";
cout << endl;
quarantine_m = 1;
}
void quarantineOff() {
cout << "Quarantine: off";
cout << endl;
quarantine_m = 0;
}
void quarantineCheck() {
cout << "Quarantine: ";
if(quarantine_m) {
cout << "on";
cout << endl;
} else {
cout << "off";
cout << endl;
}
}
string getAdress() {
return adress_m;
}
int getStorey() {
return storeyCount_m;
}
};
int main() {
Building build("dirt house", 1);
cout << build.getAdress() << " " << build.getStorey() << " storeys" << " " << endl;
build.quarantineCheck();
build.quarantineOn();
build.addStoreys(2);
cout << build.getAdress() << " " << build.getStorey() << " storeys" << " " << endl;
}
Поделитесь своими знаниями, ответьте на вопрос:
Определите, какие типы данных будут использованы при заполнении таблицы «расход фирмы» в столбцах;
type
Str = record
fio: string;
h: byte;
end;
var
base: array of Str;
i,sum,n,err:integer;
begin
write('Число учеников: '); readln(n);
setlength(base,n);
sum:=0;
writeln('Введите фамилию и рост через "space": ');
for i:=0 to n-1 do
begin
write(i+1:4,'. ');
readln(base[i].fio);
val(copy(base[i].fio,
pos(' ',base[i].fio)+1,
length(base[i].fio)-pos(' ',base[i].fio)),
base[i].h,
err);
delete(base[i].fio,
pos(' ',base[i].fio),
length(base[i].fio));
sum:=sum+base[i].h;
end;
writeln('Средний рост: ',sum/n:4:1);
for i:=0 to n-1 do
if base[i].h<sum/n then
writeln(base[i]);
end.