#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;
}
#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;
}
Поделитесь своими знаниями, ответьте на вопрос:
Найти сумму 23 первых натуральных чисел, которые при делении на 8 остаток 5. в паскаль
begin
k:=0;
i:=1;
while k<>23 do
begin;
if i mod 8=5 then
begin;
s:=s+i;
inc(k);
end;
inc(i);
end;
writeln(s);
end.