+ 1
Could anyone tell me why the following code gives errors? I want to test if the letter entered is (a)then the result is true.?
#include <iostream> using namespace std; int main() { char letter; cin>>letter; if(letter==a) cout<<"your letter is a"; return 0; }
2 Réponses
+ 4
You need to surround the a in your if condition in single quotes to make it a char.
if(letter=='a')
+ 2
@ChaoticDawg thank you alot