133k views
2 votes
Write a program that prints to the screen all the ASCII characters from 33 to 126. 33! 34''

User StackOp
by
8.3k points

1 Answer

4 votes

Answer:

#include <iostream>

using namespace std;

int main() {

for(int i=33;i<=126;i++)//Using loop to print ASCII characters.

{

cout<<i<<char(i<<" ";//statement to print integer and it's ASCII characters with values.

}

return 0;

}

Step-by-step explanation:

Put a closing parenthesis i char(i after doing that code will run .Since the answer was not getting posted hence i have to come to this resort.

I have used for loop for values 33 to 126 and for printing the ascii characters I have used typecasting converting the integer to corresponding char forcefully.

User Chip Hogg
by
8.5k points