simple/short code wont work (char and if)

#include <iostream>
#include <math.h>
#include <string>
using namespace std;

int main()
{
cout <<"String:\n";
char i[3];
cin >> i ;
if ("aa"==i)

{
cout << "\nSuccess\n";
}
system("pause");
return 0;
}

So my code is not displaying the result as it should. Any and all help would greatly be appreciated
EDIT: i need to use char not string
Last edited on
You can't use == to compare C-strings. Use strcmp().
if same string
strcmpt(string1,string2)==0
and else
strcmpt(string1,string2)!=0
Topic archived. No new replies allowed.