Oct 9, 2011 at 7:17am UTC
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!!!
Oct 9, 2011 at 8:25am UTC
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.
Oct 9, 2011 at 9:05am UTC
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