This is my code.The problem is i get an error on the last line saying:Code:#include <iostream> #include <string> using namespace std; int wordcount(char *str){ int i=0; int count=0; while(&str[i] != "\0"){ if(&str[i] == "\t"){ count++;} i++; } return count; } int main() { string stringA; cout<<"Insert a string"<<endl; cin>>stringA; cout<<"there are"<<wordcount(stringA)<<"words in your string"; }
"Cannot convert 'std::string' to 'char' for argument '1' to 'int wordcount(char*)' "
Im really stuck here, pls help .
Any help is apreciated.Thanks
Edit:Oups i posted in thw rong section.Sorry!