#include <iostream>
#include <string>
#define N 5
using namespace std;
int count_flat = 0;
struct Flat {
int n_rooms;
int square;
int floor;
string address;
double price;
void PrintInfo() {
cout << "\nКоличество комнат: " << n_rooms << "\nПлощадь " << square << "\nЭтаж:" << floor << "\nАдрес " << address << "\nЦена: " << price;
}
void InputInfo() {
cout << "Количество комнат: ";
cin >> n_rooms;
cout << "Площадь: ";
cin >> square;
cout << "Этаж: ";
cin >> floor;
cout << "Адрес: ";
getline(cin, address);
cout << "Цена: ";
cin >> price;
void PrintChecksInfo(int number) {
if (number >= price) {
count_flat++;
PrintInfo();
};
signed main() {
setlocale(LC_ALL, "Rus");
int choice;
Flat mas[N];
for (int i = 0; i < N; i++)
mas[i].InputInfo();
cout << "Введите стоимость: ";
cin >> choice;
for (int i = 0; i < N; i++) {
mas[i].PrintChecksInfo(choice);
if (count_flat <= 0)
cout << "Таких квартир нет!";
return 0;
1) #include <iostream>
int main()
{
double a, b, c;
cin>>a;
cout<<endl;
cin>>b;
cin>>c;
cout << "Среднее: " << (a+b+c)/3 << endl;
cout << "Разность: " << 2 * (a + c) - 3 * b << endl;
2) #include <iostream>
int arr[4], max = 0;
for (int i = 0; i < 4; i++)
cin >> arr[i];
if(max < arr[i] && arr[i] % 2 == 0)
max = arr[i];
if (!max)
cout << "Not found";
else
cout << "Max: " <<max;
#include <iostream>
#include <string>
#define N 5
using namespace std;
int count_flat = 0;
struct Flat {
int n_rooms;
int square;
int floor;
string address;
double price;
void PrintInfo() {
cout << "\nКоличество комнат: " << n_rooms << "\nПлощадь " << square << "\nЭтаж:" << floor << "\nАдрес " << address << "\nЦена: " << price;
}
void InputInfo() {
cout << "Количество комнат: ";
cin >> n_rooms;
cout << "Площадь: ";
cin >> square;
cout << "Этаж: ";
cin >> floor;
cout << "Адрес: ";
getline(cin, address);
cout << "Цена: ";
cin >> price;
}
void PrintChecksInfo(int number) {
if (number >= price) {
count_flat++;
PrintInfo();
}
}
};
signed main() {
setlocale(LC_ALL, "Rus");
int choice;
Flat mas[N];
for (int i = 0; i < N; i++)
mas[i].InputInfo();
cout << "Введите стоимость: ";
cin >> choice;
for (int i = 0; i < N; i++) {
mas[i].PrintChecksInfo(choice);
}
if (count_flat <= 0)
cout << "Таких квартир нет!";
return 0;
}
1) #include <iostream>
using namespace std;
int main()
{
double a, b, c;
cin>>a;
cout<<endl;
cin>>b;
cout<<endl;
cin>>c;
cout << "Среднее: " << (a+b+c)/3 << endl;
cout << "Разность: " << 2 * (a + c) - 3 * b << endl;
}
2) #include <iostream>
using namespace std;
int main()
{
int arr[4], max = 0;
for (int i = 0; i < 4; i++)
{
cin >> arr[i];
if(max < arr[i] && arr[i] % 2 == 0)
{
max = arr[i];
}
}
if (!max)
{
cout << "Not found";
}
else
{
cout << "Max: " <<max;
}
}