Write a program that asks the user to enter a long sentence

Write a program that asks the user to enter a long sentence, then returns (prints out) the number of letter E (ou e) in the sentence. Use a for loop to answer this question. Upload and submit your .cpp code.

The length of an array named t is obtained using t.length().

Solution

#include #include using namespace std; int main(){ char line[150]; int i,v,ch,o; o=v=ch=0; cout << \"Enter a line of string: \" << endl; cin.getline(line, 150); for(i=0;line[i]!=\'\\0\';++i) { if(line[i]==\'e\' || line[i]==\'E\') ++v; } cout << \" E or e: \" << v << endl; return 0; }
Write a program that asks the user to enter a long sentence, then returns (prints out) the number of letter E (ou e) in the sentence. Use a for loop to answer t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site