Write a program in C++ to print the code (ASCII code / Unicode code etc.) of a given character

  • برمجة سي بلس بلس
  • برمجة

Write a program in C++ to print the code (ASCII code / Unicode code etc.) of a given character

Sample Output:

 Print code (ASCII code / Unicode code etc.) of a  given character:    
-----------------------------------------------------------------------
 Input a character: a                                                  
 The ASCII value of a is: 97                                           
 The character for the ASCII value 97 is: a

الأجوبة

#include <iostream>
using namespace std;
int main() 
{
    char sing_ch; 
	cout << "\n\n Print code (ASCII code / Unicode code etc.) of a  given character:\n";
	cout << "-----------------------------------------------------------------------\n";
 	cout << " Input a character: ";
	    cin >> sing_ch;	
	
  cout <<" The ASCII value of "<<sing_ch<<" is: " <<(int)sing_ch << endl; 
  cout <<" The character for the ASCII value "<<(int)sing_ch <<" is: "<<(char)((int)sing_ch) << endl<< endl; 
  return 0;
}
C++
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...