string.at not working

Hey yall,

I'm doing a letter to number translator, just as a test for one of my friends. I have this line:
1
2
3
4
5
6
7
  string letters;
	cout << "Type the phrase you want: ";
	cin >> letters;
	cout << letters.length() << " characters recognised." << endl;
	for (int i = 0; i < letters.length(); i++){
		if (letters.at(i) == "a" or letters.at(i) == "A"){ cout << "1" << endl;}
...


And for the if statements I get this error.
"ISO C++ forbids comparison between pointer and integer"
So, can anyone help me out here? I'd like to keep using the same basic formula/style with my code but get rid of these damn errors.
at() returns a char. "a" is a char* (string).
You mean 'a' (single quotes).
Aaaaaaah, of course, thanks man.
Use the find method if you need to specify a string, rather than just a character.
Topic archived. No new replies allowed.