Mega Code Archive

 
Categories / C++ Tutorial / Operators Statements
 

Lowercase letters using bitwise OR

#include <iostream> using namespace std; int main() {   char ch;   for(int i = 0 ; i < 10; i++)  {     ch = 'A' + i;     // This statement turns on the 6th bit.     cout << ch << " " ;     ch = ch | 32;     cout << ch << "\n";   }   return 0; } A a B b C c D d E e F f G g H h I i J j