Question
*************************************************************************** Name: kulwant kaur Student ID:301108947 Section:002 *************************************************************************** [5 MARKS] Create a program that declares the following two variables: - a character variable initialized to
*************************************************************************** Name: kulwant kaur Student ID:301108947 Section:002 *************************************************************************** [5 MARKS]
Create a program that declares the following two variables: - a character variable initialized to the letter 'A'. - an integer variable initialized to the integer 0.
Next the program should prompt the user to enter an uppercase or lowercase character from the keyboard.
The program should then print both the character AND the decimal ASCII value of the character entered from the keyboard. Note that the ASCII value of the character can be obtained by type casting the character variable to an integer.
Refer to the sample run below:
NOTE: The Name, Student ID and Section that appears in the output of the program should be your own, not the ones used in the sample run.
--- Sample run 1: --------
*********************************************************************** Name: Smith, Peter Student ID: 300999999 Section: 002 *********************************************************************** Enter an uppercase or lowercase character: c (Note: c from the keyboard)
ASCII value of character c is: 99 Press any key to continue . . .
PROGRAM OUTPUT - Provide TWO sample runs and paste it to your WORD document: - For the FIRST sample run, input from the keyboard uppercase W. - For the SECOND sample run, input from the keyboard lowercase u.
*/ #include
int main() { system("pause"); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started