I am writing a program in which a single letter in form of char variable is taken from the user, then if the value is "m" then print "You r Male" otherwise "You r female"...
#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
char A,M;
cout<<"Enter any single letter";
cin>>A;
if(A==M)
cout<<"You are Male";
else
cout<<"You are Female";
getch();
}]
The problem is that it gives an error that the variable 'M' is used before being initialized????How to deal with this....I mean what does it actually means???
M is a character so it cannot be used like int if(A=='M') // see the quotes as it is single character
if you intent to use more than one character you has to use double quotes
like this if(strcmp(A,"Male"))