1. PLEASE learn to use code tags, it makes your code easier to read, and to comment.
You can go back, edit your post and add code tags.
http://www.cplusplus.com/articles/jEywvCM9/
2. Your first for loop has a logic error, it should be: for (int x = 1; x <= 50; x++)
3. All the if statements after the first for loop run only once, so your vector only in very exceptional cases get even one number pushed back. Maybe they should be within the for loop after the random number is generated?
4. Global variables are not the best design, and having all your variables being declared as global can cause problems. Especially when you use functions.
5. Using the C library pseudo-random generator when writing C++ code. *SMH* Even the C ISO Standard recommends not using srand and rand.
C++ has a robust random number library in the header <random>.
The problem is essentially to check if a random number falls within any of the non-overlapping ranges: Random number generation - apart from the use of rand() the other mistake is that you're generating random numbers in the range 1-100 but want to check if the generated number falls within the range 97-122 (a-z) most of which is never going to happen Non-overlapping ranges check - you don't need to check each range separately, rather you can create std::set<std::pair<int,int>> with the lower and upper bounds of each range and a custom comparator and check if you can std::set<std::pair<int,int>>.find the number within the set