case sensitive comaparison

Hello all

I wanted to know if case sensitive comparison is possible between characters, not strings? Could anyone please tell me how do I go about it.

Thanks
You can use the == operator

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>

int main()
{
  char charA, charB;
  
  std::cout << "Enter char one" << std::endl;
  std::cin >> charA;
  std::cout << "Enter char two" << std::endl;
  std::cin >> charB;

  std::cout << "Is "<< charA << " the same as " << charB <<"?" << std::endl;
  if (charA == charB)
  {
    std::cout << "Yes";
    
  }
  else
  {
    std::cout << "No";
  }
  return 0;
}
alright Moschops. Thanks a lot
Topic archived. No new replies allowed.