Question: #include using namespace std; int main() { char val; int ascii; int value1, value2; int num; cout < < Enter lower and upper values ;
#include
using namespace std;
int main() { char val; int ascii; int value1, value2; int num; cout << "Enter lower and upper values "; cin >> value1; cin >> value2;
while(value1 < 32 || value2 > 126 || value1 > value2) { cout << "Values must be in range 32 to 126 inclusive"; cout << "Enter lower and upper values"; cin >> value1 >> value2; } cout << "Characters for ASCII values between xx and yy "; cout << "----+----+----+- "; for(value1; value2; value1++) { cout << value1; num++; if(num ==16) { num = 0; } } for (ascii=1; ascii<126;ascii++) { val= ascii; cout << ascii << endl; }
return 0; }
************************************This is the ouput im supposed to generate
32 126
The display function will output:
Characters for ASCII values between 32 and 126 ----+----+----+- !"#$%&'()*+,-./ 0123456789:;<=>? @ABCDEFGHIJKLMNO PQRSTUVWXYZ[\]^_ `abcdefghijklmno pqrstuvwxyz{|}~ ----+----+----+- **************
Input to cin:
32 126
Output to cout:
Enter lower and upper values Characters for ASCII values between 32 and 126 ----+----+----+- !"#$%&'()*+,-./ 0123456789:;<=>? @ABCDEFGHIJKLMNO PQRSTUVWXYZ[\]^_ `abcdefghijklmno pqrstuvwxyz{|}~ ----+----+----+- Here is a second run with some invalid input values for cin:
127 31 33 46
We get the following output:
Enter lower and upper values Values must be in range 32 to 126 inclusive Enter lower and upper values Characters for ASCII values between 33 and 46 ----+----+----+- !"#$%&'()*+,-. ----+----+----+-
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
