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

Write an algorithm and C++ code in the following input .txt to find word count,

ID: 3814870 • Letter: W

Question

Write an algorithm and C++ code in the following input .txt to find word count, number of sentences, and number of times the word “video” is repeated. Find also the word count by omitting “and”.
Technology is advancing exponentially without signs of slowing. With this advancement comes the exponential growth of realism in video gaming. One could postulate that visual realism is only bounded by technological development. As the video game industry moves toward virtual and augmented reality, the current balance of violence in video games and morality may be shifted. The more realistic an experience, the more severe of an effect conveyed to a participant. Developers must be cautious as realism grows unbounded; they must make sure that video game experiences do not begin to blur the line between reality and fantasy; doing so could spell disaster. This check can be accomplished by remembering video games’ original purpose: entertainment. Many casual gamers use video games to escape reality. Rather than work toward the zenith of virtual reality, perhaps video game developers could focus more heavily on themes whose nature is fantastical; such would negate the fear of moral corruption. Write an algorithm and C++ code in the following input .txt to find word count, number of sentences, and number of times the word “video” is repeated. Find also the word count by omitting “and”.
Technology is advancing exponentially without signs of slowing. With this advancement comes the exponential growth of realism in video gaming. One could postulate that visual realism is only bounded by technological development. As the video game industry moves toward virtual and augmented reality, the current balance of violence in video games and morality may be shifted. The more realistic an experience, the more severe of an effect conveyed to a participant. Developers must be cautious as realism grows unbounded; they must make sure that video game experiences do not begin to blur the line between reality and fantasy; doing so could spell disaster. This check can be accomplished by remembering video games’ original purpose: entertainment. Many casual gamers use video games to escape reality. Rather than work toward the zenith of virtual reality, perhaps video game developers could focus more heavily on themes whose nature is fantastical; such would negate the fear of moral corruption. Write an algorithm and C++ code in the following input .txt to find word count, number of sentences, and number of times the word “video” is repeated. Find also the word count by omitting “and”.
Technology is advancing exponentially without signs of slowing. With this advancement comes the exponential growth of realism in video gaming. One could postulate that visual realism is only bounded by technological development. As the video game industry moves toward virtual and augmented reality, the current balance of violence in video games and morality may be shifted. The more realistic an experience, the more severe of an effect conveyed to a participant. Developers must be cautious as realism grows unbounded; they must make sure that video game experiences do not begin to blur the line between reality and fantasy; doing so could spell disaster. This check can be accomplished by remembering video games’ original purpose: entertainment. Many casual gamers use video games to escape reality. Rather than work toward the zenith of virtual reality, perhaps video game developers could focus more heavily on themes whose nature is fantastical; such would negate the fear of moral corruption.

Explanation / Answer

The required code is as follows:

#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;

int main()
{
ifstream fin;
fin.open("input.txt");

int countwords=0, countsentences = 0, countvideo = 0, countand = 0;
while(!fin.eof())
{
char a[100];
fin >> a;

if(!strcmp(a, "video"))
{
countwords++;
countvideo++;
}
else if(a[strlen(a)-1] == '.')
{
countwords++;
countsentences++;
}
else if(!strcmp(a, "and"))
{
countand++;
countwords++;
}
else
countwords++;
}
cout << "The number of words is: " << countwords << endl;
cout << "The number of sentences is: " << countsentences << endl;
cout << "The number of times "video" is repeated is: " << countvideo << endl;
cout << "The word count (omitting "and") is: " << countwords - countand << endl;
}

And the output for the given paragraph is:

The number of words is: 155
The number of sentences is: 9
The number of times "video" is repeated is: 7
The word count (omitting "and") is: 152

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote