Find letter 's position in Alphabet using Bit operation | C ++ implementation of the approach ; Function to calculate the position of characters ; Performing AND operation with number 31 ; Driver code
#include <iostream> NEW_LINE using namespace std ; const int NUM = 31 ; void positions ( string str , int n ) { for ( int i = 0 ; i < n ; i ++ ) { cout << ( str [ i ] & NUM ) << " ▁ " ; } } int main ( ) { string str = " Geeks " ; int n = str . length ( ) ; positions ( str , n ) ; return 0 ; }