#include <iostream>
#include <string>
using namespace;
int main()
{
string word = " ";
do
{
cout << "Enter a word that has at least 5 characters: " << endl;
cin >> word;
}while(word.size() < 5);
char searchCh = '0';
cout << "Enter a character and the program will tell " <<
"you how many times it appears in the word " << word << "." << endl;
cin >> searchCh;
int counter = 0;
for(int i = 0; i < (int)word.size(); i++ )
{
char ch = word.at(i)
if(searchCh == ch)
{
counter++; //counter = counter + 1
}
}
cout << "The number of " << searchCh << " 's in the word " << word << " is " << counter << ".\n";
}
I continuously receive multiple errors such as: 'endl' was not declared in the scope 'cin' was not declared in this scope 'word' was not declared in this scope 'string' was not declared in this scope expected ',' or ';' before '}' token
I am using codeblocks, if anyone could answer it would be much appreciated. Thank you:D