Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using std::cin;
- using std::cout;
- using std::endl;
- int main()
- {
- int SIZE = 4;
- int tenTo100[SIZE];
- int temp = 0;
- int counter = 0;
- int numToDisplay = SIZE;
- for(int x = 0;x <= SIZE;++x)
- {
- cin >> temp;
- while(!(temp >= 10 && temp <= 100)) //checks the range of the temp number.
- {
- cout << "enter a new number between 10 and 100: ";
- cin >> temp;
- }
- if(x == 0)
- {
- tenTo100[counter] = temp;
- ++counter;
- }
- else if(x > 0)
- {
- bool isDup = false;
- for(int y = counter-1; y >= 0; --y)
- {
- if(temp == tenTo100[y])
- {
- isDup = true;
- }
- }
- if(isDup == false)
- {
- tenTo100[counter] = temp;
- ++counter;
- }
- }
- }//end of the for loop
- cout << endl;
- for(int y = 0; y <= counter-1;++y)
- {
- cout << tenTo100[y];
- cout << endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment