Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- int main()
- {
- int array[5] = { 10,20,30,40,50 };
- int value = 0;
- std::cout << "please pick a value between 0 and 4: " << std::endl;
- std::cin >> value;
- while (value > 4 || value < 0)
- {
- std::cout << "Please only select a value between 0 and 4: ";
- std::cin >> value;
- }
- std::cout << "Your number is: " << array[value] << std::endl;
- _getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement