Question: 27.3 Unit 2 - Exercise 1C This lab will be available until January 2816 2:30 PM CST Warning: you MUST use a for loop for
27.3 Unit 2 - Exercise 1C This lab will be available until January 2816 2:30 PM CST Warning: you MUST use a for loop for points in this exercise. Write a program to accept a senterice from user input and count the number of words in the sentence. The program's output is the number of words that are entered. The words are separated by single spaces, so counting the spaces will help you counting the words For example, if the user enters the following This is the Unit2 test of COSCI 430. the program will output Hint: You can use the getline(cin, string_var) function to receive the user input from the keyboard and the at(1) function to access the character at the th position of the string to get the number of characters in a string, use the length() function 20600173350 0/35 LAD ACTIVITY 27.3.1: Unit 2 - Exercise 1 main.cpp
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
