@Narue: ... it wasnt working before ... I've been googling and they suggested string& and char * something too ... Thanks a lot for your resposne anyway, this is the main reason why i can never do IT. >.<
1 more question: when i assign a variable of type string str1 to a, and variable of type char to str2, how do u do that ? Just wondering.
using namespace std;
void CountLetter(string a, char b)
string str1 = a;
char str2 = b;
cout << str1 << "\n";
cout << str2 << "\n";
cin >> a;
To return a value from the function and assign it to the integer a (as in your code):
1) Make the function an int instead of void
2) Set an integer variable val to some value in the function
3) return val; at the end of the function
4) Set a to the function in main() , like so: a = CountLetter("tttyuttt", 't'); I like the way you are writing small snippets of code to understand the program parts. Most people get so lost because they don't to this.