Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <windows.h>
- using namespace std;
- int main()
- {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- float x=0;
- int an=0;
- cout << "Введите a[n]: ";
- cin >> an;
- float *a = new float[an];
- for (int i = 0; i < an; i++) {
- cout << "Введите a[" << i+1 << "]" << ": ";
- cin >> a[i];
- }
- cout << "Введите X: ";
- cin >> x;
- for (int i = 0; i < (an - 1); ++i) {
- if ((x >= a[i]) && (x < a[i+1])) {
- cout << a[i] << " <= " << x << " < " << a[i+1] << "\n";
- }
- }
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment