assignment 1

hello'' can you help about my problem?
our adviser gives a assignment ,

its going like this:

create a programe that accepts a sentence and counts every letter on it using array,

thanks!!!
You read the string into an array (cin.getline or cin>>), iterate through it (for loop) and for each letter (if statement) increments a counter variable.
first create a string for instance - string sentence;

than input the string - getline(cin, sentence);

after you have received input pass your string to a countong function - sentence.legth();

if you want to output the number of letters to the screen - cout<< sentence.legth();

that;s it. enjoy
Topic archived. No new replies allowed.