What will be print after executing following statement int value=65; char ch=value; cout<
Question
What will be printed after executing the following statement?
int value = 65;
char ch = value;
cout << ch;
Solution
After executing the statement "int value=65; char ch=value; cout<<ch;", the output will be the character 'A'.
Here is the step-by-step explanation:
- The variable "value" is declared as an integer and assigned the value 65.
- The variable "ch" is declared as a character and assigned the value of "value". Since the ASCII value of 65 corresponds to the character 'A', the variable "ch" now holds the character 'A'.
- The "cout" statement is used to output the value of "ch". When the character 'A' is printed, it will be displayed as the output.
Similar Questions
What will be the output of the following code? int i = 1;while(i<10){ if (i / 2 == 2) cout << i << “ ”;i++;}
What will this code print? #includeusing namespace std;int x = 7;int main(){int x = 2;{int x = 3;cout << ::x << endl;}return 0;}
What will be the output of the following code?string str = "abcdef";cout << str.substr(2, 3);"abc""def""cde""bcd"
. Find the output of the following program.main(){ int i = (1, 2, 3); cout << i << endl;}
What will be output when you will execute following c++ code?int main(){int a=5,b=10;if(++a||++b)printf(“%d %d”,a,b);elseprintf(“Doraemon”);}1,24,95,96,10
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.