Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a program that asks the user to enter a few sentences - print out the numb

ID: 3796865 • Letter: W

Question

write a program that asks the user to enter a few sentences - print out the number of sentences they entered.

#include

using namespace std;

int characterarray(char [], int);

int main()
{
const int num = 30;
int X = 0;
char a = '?';
char sentence[num];

cout << "Enter a few sentences: " << endl;
cin.getline(sentence, num);

//cout << int(a) << endl;

X = characterarray(sentence,num);

cout << "The number of sentences written: " << X << endl;

return 0;
}
int characterarray(char val[], int amount)
{
int index = 0;

while(val[index] != '')
{
if(val[index] >= 0 && val[index] <= 122)
{
if(val[index] >= 33 && val[index] <= 63)
{
index++;
}
}
}
return index;
}

***** hi this is my code - what am I doing wrong =

Review Test Submission X lackboard morehouse.edu/webapps/assessmentireview/review.jsp?attempt id .555585 18course id .31604 18content id 343022 18outcome id 569752 1&outcome; definition Time Elapsed 1 hour, 42 minutes Instructions This test is closed book, but you can use your complier and past code (in your complier) help with the problems. o Question 1 Step 1 create two integer pointers of size Needs Grading function 4 Each element of the both array pointers should be filled with random numbers from o to 100. Pass the address of both array pointers into a called mergeArrays. Step 2: Inside the function, merge both arrays together into one pointer array of size 8, en return a pointer to the new merged array. Step 3: Back in the main function, print out the contents of array 1 and 2 separately, then print out the contents of the merged array Use only pointer notation Question 2 Needs Grading Write a program that asks the user to enter a few sentences. Then print out the number of sentences they entered. Question 3 Needs Gradmg Step 1: Create a Circle structure to store the following data: Radius. Center X, Center Y, and Area Step 2: Ask the user to enter the number of circles to created. Then create that many Circle structures using an array pointer Step 3 For each circle, randomly generate the data for the Radius, center x, Center Y, and calculate the Area. Step 4: Print out the Radius. Center x, Center Y. and Area for each circle Step 5: Search through each circle, and print out the data for the circles whose area is greater than 10,000 Use only pointer notation Wednesday, February 22, 2017 3:34.47 PM EST

Explanation / Answer

There are many errors your code, please see correct code below.

Note: Program treats one line entered by the user as one sentence.

C++ code:

#include <bits/stdc++.h>
using namespace std;

int main()
{
   int count;
   string s;
   while(true)
   {
       cout << "Enter new sentence or enter done to stop! ";
       getline(cin,s);
       if(s == "done")
       {
           break;
       }
       else
       {
       count++;
   }
   }

   cout << "You entered " << count << " sentences! ";
}

Sample Output:

Enter new sentence or enter done to stop!
this is first sentence.
Enter new sentence or enter done to stop!
this is second sentence.
Enter new sentence or enter done to stop!
same line. But multiple sentences will be counted as one line.
Enter new sentence or enter done to stop!
done
You entered 3sentences!