I've been doing a program that recieves N number of words that are entered by user. All letters that are contained in those words should be printed only once.
#include <iostream>
#include <cstdlib>
#include <ctype.h>
#include <string>
using namespace std;
int main(){
int N=0;
string allCharacters;
while(N<=0){
cout << "Enter number of words you would like to type (positive number):";
cin>>N;
if(cin.fail())
{
cin.clear();
cin.ignore(256,'\n');
N=0;
}
}
for(int i=0; i<N; i++)
{
string input;
cin>>input;
for(int j=0; j<input.size(); j++)
{
if(allCharacters.find(tolower(input[j])) == string::npos) // if not found
allCharacters.append(tolower(input[j])); // ERROR HERE
}
}
for(int i=0; i<allCharacters.size();i++)
{
cout << allCharacters[i]<<endl;
}
return 0;
}
The error is: Line 33: [Error] invalid conversion from 'int' to 'const char*' [-fpermissive]"
But I do not understand it. I entered a string called "input" and should check each character in that string, but it says that input is int?