Skip to main content

Chuyển chữ thuờng qua chữ hoa C/C++

Code chuyển chữ thuờng qua chữ hoa C/C++

Cách 1

Lấy ký tự đó + 32 ( theo bảng mả ASII)


  1. int main()
  2. {
  3.    
  4.          char a;
  5.          cout<<" Enter the letter   : ";
  6.          cin>>a;
  7.          if ( (>= 'A') && (<= 'Z') )
  8.          {
  9.                 int k =  int (a) + 32 ;
  10.                 cout<< " The upper case character corresponding to "<< a << "  is ..." << char(k);
  11.          }
  12.          else if ( (>= 'a') && (a<= 'z') )
  13.          {
  14.                 int k = int (a) - 32;
  15.                 cout<< " The lower case character corresponding to " << a << " is  : " << char(k);
  16.          }
  17.          else cout<< " number  " << a;
  18.          cout<< endl;
  19.          system ("pause");
  20.          return 0;
  21. }

Cách 2:

Sử dụng hàm
  1. char *strlwr(char *s) // Hoa sang thường
  2. char *strupr(char *s) // Thường sang hoa

Comments

Popular posts from this blog

Socket Android Client to PC Server C#

Using AsynCallback C# Android Client connect Server C# Source code:  http://ow.ly/OlXj309O1mj c# socket multi client, socket c# example, socket server c#, socket c# tutorial, asynchronous socket in c#, c# socket multiple clients, c# socket server multiple clients, Download source code:  Click Here

Bài tập thuật toán C/C++ Và Tuyển tập đề thi olympic

Gồm: +  Các thuật toán của Lê Minh Hoàng + Tuyển tập các đề thi olympic tin học sinh viên Link down: Tại đây

Cross Platform Mobile App: Demo shop with flutter

Cross Platform Mobile App: Demo shop with flutter So cool framework from google <3  Demo:  Demo Code console.print("hello")