Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. /*YIA180000
  2. Yusef Alimam
  3. 10/18/2019*/
  4.  
  5. #include <iostream>
  6. #include <iomanip>
  7. #include <cstdlib>
  8. #include <cstring>
  9.  
  10. using namespace std;
  11.  
  12. int main() {
  13.  
  14.     unsigned int numOne, numTwo;
  15.  
  16.     cout << "Enter lower and upper values";
  17.     cin >> numOne;
  18.     cin >> numTwo;
  19.     cout << endl;
  20.  
  21.     while (numOne < 32 || numOne > 126) {
  22.  
  23.         cout << "Values must be in range 32 to 126 inclusive" << endl;
  24.         cout << "Enter lower and upper values" << endl;
  25.         cin >> numOne;
  26.         cin >> numTwo;
  27.  
  28.     }
  29.  
  30.     while (numTwo < 32 || numTwo > 126) {
  31.  
  32.         cout << "Values must be in range 32 to 126 inclusive" << endl;
  33.         cout << "Enter lower and upper values" << endl;
  34.         cin >> numOne;
  35.         cin >> numTwo;
  36.  
  37.     }
  38.  
  39.     while (numOne > numTwo) {
  40.  
  41.         cout << "Values must be in range 32 to 126 inclusive" << endl;
  42.         cout << "Enter lower and upper values" << endl;
  43.         cin >> numOne;
  44.         cin >> numTwo;
  45.  
  46.     }
  47.  
  48.    
  49.     while (numOne >= 32 && numOne <= 126 && numTwo >= 32 && numTwo <= 126 && numOne < numTwo) {
  50.  
  51.         cout << "Characters for ASCII values between " << numOne << " and " << numTwo << endl;
  52.         cout << "----+----+----+----+" << endl;
  53.         int i;
  54.         int m;
  55.             for( i = numOne; i <= (numTwo); i++) {
  56.  
  57.                     char c = i;
  58.                     cout << c;
  59.                 }
  60.                
  61.         cout << endl <<  "----+----+----+----+" << endl;
  62.         break;
  63.     }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement