PascalABC.NET
#1
function Y(x:integer) := 2*((x+2)**2)+5.5*(x+2) - 3;
begin
var Xes := Range(3, 25);
Xes.Tabulate(p -> Y(p)).Println;
end.
#2
const PASS = '123ab';
var rpass := Readstring('Pass: ');
while rpass <> PASS do begin
rpass := Readstring('Wrong pass. Try again: ');
end;
print('Correct password. Welcome');
#3
//Сначала читаем цифру, которую надо удалить, а уже потом число.
var X := ReadChar();
var number := ReadInteger().ToString.ToCharArray.ToList;
while number.Contains(X) do number.Remove(X);
number.JoinIntoString.Println;
#4
var X := ReadInteger();
Print((x div 100)+(x mod 100));
Объяснение:
#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";
quarantine_m = 0;
void quarantineCheck() {
cout << "Quarantine: ";
if(quarantine_m) {
cout << "on";
} else {
cout << "off";
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);
PascalABC.NET
#1
function Y(x:integer) := 2*((x+2)**2)+5.5*(x+2) - 3;
begin
var Xes := Range(3, 25);
Xes.Tabulate(p -> Y(p)).Println;
end.
#2
const PASS = '123ab';
begin
var rpass := Readstring('Pass: ');
while rpass <> PASS do begin
rpass := Readstring('Wrong pass. Try again: ');
end;
print('Correct password. Welcome');
end.
#3
begin
//Сначала читаем цифру, которую надо удалить, а уже потом число.
var X := ReadChar();
var number := ReadInteger().ToString.ToCharArray.ToList;
while number.Contains(X) do number.Remove(X);
number.JoinIntoString.Println;
end.
#4
begin
var X := ReadInteger();
Print((x div 100)+(x mod 100));
end.
Объяснение:
#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;
}