C++ program to show the use of ‘char’ data type.
Q2. Write a C++ program to show the use of ‘char’ data type.
Solution:
#include<iostream.h> //standard input/output header file
#include<conio.h> //for clrscr()
int main()
{
char mychar1,mychar2;
clrscr(); //to clear the screen
mychar1=’A’;
mychar2=’B’;
cout<<“\n Mychar1=”<<mychar1;
cout<<“\n Mychar2=”<<mychar2;
getch(); //holds the screen until a key is pressed
return 0;//makes the main() to finish
}
OUTPUT:
Mychar1=A
Mychar2=B