Guest User

Untitled

a guest
Apr 20th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <deque>
  3. #include <string>
  4. #include <windows.h>
  5. #include <cstdlib>
  6. #include <algorithm>
  7. #include <functional>
  8.  
  9. using namespace std;
  10.  
  11.  
  12. int main()
  13. {
  14. SetConsoleCP(1251);
  15. SetConsoleOutputCP(1251);
  16. int i = 0;
  17. int u = 0;
  18. const int dequeSize = 10;
  19.  
  20. //Первый дек
  21. std::deque<int> myDeque(dequeSize);
  22.  
  23. cout << "Введите элементы дека" << endl;
  24. for (i = 0; i<dequeSize; i++)
  25. {
  26. cout << "Введенный дек [" << i << "] = ";
  27. while(!(cin>>myDeque[i]))
  28. {
  29. cout<<"~~~~~~~~~~~~~"<<endl;
  30. cout<<"ОШИБКА"<<endl;
  31. cout<<"Введите число: ";
  32. cout<<endl<<endl<<endl<<endl;
  33. cin.clear();
  34. cin.sync();
  35. }
  36.  
  37. }
  38.  
  39.  
  40.  
  41. for (i = 0; i < (dequeSize - 1); i++)
  42.  
  43. if (myDeque[i] > myDeque[i + 1])
  44. break;
  45.  
  46. if (i == (dequeSize - 1)){
  47.  
  48. cout << "Sorted";
  49. }else{
  50.  
  51. cout << "Not Sorted";
  52.  
  53. }
  54.  
  55. //////Проблема Здесь//////
  56.  
  57.  
  58. while(!(i == (dequeSize - 1))){
  59.  
  60. cout << "Введите элементы дека" << endl;
  61. for (i = 0; i<dequeSize; i++)
  62. {
  63. cout << "Введенный дек [" << i << "] = ";
  64. while(!(cin>>myDeque[i]))
  65. {
  66. cout<<"~~~~~~~~~~~~~"<<endl;
  67. cout<<"ОШИБКА"<<endl;
  68. cout<<"Введите число: ";
  69. cout<<endl<<endl<<endl<<endl;
  70. cin.clear();
  71. cin.sync();
  72. }
  73. }
  74. }
  75.  
  76. while(!(i == (dequeSize - 1))){
Add Comment
Please, Sign In to add comment