Guest User

Untitled

a guest
Dec 4th, 2014
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <windows.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. SetConsoleCP(1251);
  10. SetConsoleOutputCP(1251);
  11.  
  12. float x=0;
  13. int an=0;
  14.  
  15. cout << "Введите a[n]: ";
  16. cin >> an;
  17.  
  18. float *a = new float[an];
  19.  
  20. for (int i = 0; i < an; i++) {
  21. cout << "Введите a[" << i+1 << "]" << ": ";
  22. cin >> a[i];
  23. }
  24.  
  25. cout << "Введите X: ";
  26. cin >> x;
  27.  
  28. for (int i = 0; i < (an - 1); ++i) {
  29. if ((x >= a[i]) && (x < a[i+1])) {
  30. cout << a[i] << " <= " << x << " < " << a[i+1] << "\n";
  31. }
  32. }
  33.  
  34. system("PAUSE");
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment