Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3.  
  4. int main()
  5. {
  6.     int array[5] = { 10,20,30,40,50 };
  7.     int value = 0;
  8.  
  9.     std::cout << "please pick a value between 0 and 4: " << std::endl;
  10.     std::cin >> value;
  11.     while (value > 4 || value < 0)
  12.     {
  13.         std::cout << "Please only select a value between 0 and 4: ";
  14.         std::cin >> value;
  15.     }
  16.     std::cout << "Your number is: " << array[value] << std::endl;
  17.     _getch();
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement