Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "ru");
- const int size = 40;
- int arr[size] = { 2,3,6,5,2,3,4,1,7,3,4,5,2,3,4,1,2,3,4,5,8,3,4,1,2,3,4,5,7,3,4,1,2,3,4,5,2,6,4,1};
- int number;
- cout << "Введите номер квартиры (от 1 до 40): ";
- cin >> number;
- number--;
- cout << "В квартире проживает: " << arr[number] << " человек" << endl;
- if (number % 2 == 0) {
- cout << "В соседней квартире проживает: " << arr[number + 1] << " человек" << endl;
- }
- else {
- cout << "В соседней квартире проживает: " << arr[number - 1] << " человек" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement