Answer to Question #128823 in C++ for kern

Question #128823
Write a program that counts the number of characters in the sentence entered by the user and displays it on the screen.
1
Expert's answer
2020-08-11T10:40:50-0400
#include <iostream>
#include <string>
using namespace std;

int main()
{
    string str;
    cout << "Enter your sentence\n";
    getline(cin, str);
    cout << "Number of characters per line is " << str.size();
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS