The most obvious error in that code is
Quote:
Originally Posted by edu_linux
Code:
for(int i=0;sent[i]='\0';i++)
|
A single
= means assignment, even when used where it looks like an equality test.
An equality test requires
==
But the middle value of a
for is a continue condition, not a stopping condition, so I think you need
!=
For the more complicated project requested in the title of your post: You shouldn't expect us to do your homework for you.
I expect the point of the assignment is to learn something about associative containers, such as std::map. If you have learned something about that already, then you should be able to figure out how to apply that knowledge to this problem. If you haven't learned about std::map yet, now is a good time to learn that.
You also should know how to use std::string. Working with C strings (char const*) is practical in C++, but in a lot of uses (such as the key for an associative container) a std::string is a lot easier to use.