Advertisement
Serafim_

Заполнение массива с клавиатуры

Oct 11th, 2017
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using std::cout;
  5. using std::cin;
  6. using std::endl;
  7.  
  8. int main()
  9. {
  10.         int arr[10];
  11.  
  12.         // Заполняем массив с клавиатуры
  13.         for (int i = 0; i < 10; i++) {
  14.             cout << "[" << i + 1 << "]" << ": ";
  15.             cin >> arr[i];
  16.         }
  17.  
  18.         // И выводим заполненный массив.
  19.         cout << "\nВаш массив: ";
  20.  
  21.         for (int i = 0; i < 10; ++i) {
  22.             cout << arr[i] << " ";
  23.         }
  24.  
  25.         cout << endl;
  26.  
  27.         return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement