1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Travka [436]
3 years ago
8

Write a program that asks the user for two file names. The first file will be opened for input and the second file will be opene

d for output. (It will be assumed that the first file contains sentences that end with a period.) The program will read the contents of the first file and change all the letters to lowercase except the first letter of each sentence, which should be made uppercase. The revised contents should be stored in the second file.
Computers and Technology
1 answer:
Wewaii [24]3 years ago
5 0

Answer:

#include <iostream>

#include <fstream>

#include <string>

using namespace std;

int main()

{

//First we declare string variables to store file names for input and output

   string inputName;

   string outputName;

   string sentence;

// Then declare char variable to get current char

   char ch;

//The following section will prompt theuser to enter the file names and read

   cout << "Enter input file name:\n";

   cin >> inputName;

   cout << "Enter output file name:\n";

   cin >> outputName;

//ignore newline character left inside keyboard buffer

   cin.ignore();

//Next we define the input and output files to be opened

   ifstream inputFile(inputName);

   ofstream outputFile(outputName);

   if(!inputFile && !outputFile){

       cout << "Error while opening the files!\n";

       cout << "Please try again!\n";

       //end program immediately

       return 0;

   }

//Using this loop to get lines one by one, delimited by '.'

   while(getline(inputFile, sentence, '.')){

       //bool variable to store if we have already

       //printed capital first letter

       bool alreadyCapitalized = false;

       //Using of for loop on all characters of sentence

       for(int counter = 0; counter < sentence.length(); counter++){

           //if not alphabetical character,

           //so whitespace or newline, print as is

           if(!isalpha(sentence[counter]))

               outputFile << sentence[counter];

       //Condition statement for if it is alphabetical and no capitalization has been done, print it as uppercase

           if(!alreadyCapitalized && isalpha(sentence[counter])){

               outputFile << (char)toupper(sentence[counter]);

               alreadyCapitalized = true;

           }

           //otherwise print this condition as lowercase

           else if(alreadyCapitalized)

               outputFile << (char)tolower(sentence[counter]);

       }

       //Printing of the output sentence with period in the end

       outputFile << ".";

   }

   //Closing the files

   inputFile.close();

   outputFile.close();

   return 0;

}

You might be interested in
___________ is a computer processor which incorporates the functions of a computer's central processing unit (CPU) on a single i
Yanka [14]

Answer:

Microprocessor

Explanation:

A microprocessor is a programmable chip that incorporates in itself the functions of a computer's central processing unit. It contains millions of small components such as transistors and resistors. In fact, the microprocessor is sometimes called the CPU itself as it contains an Arithmetic Logic Unit(ALU), a control unit and register array.

They work at a very high speed due to the components that they contain and are available at relatively low cost. They are portable, reliable and compared to vacuum tubes, they generate less heat.

<em>Hope this helps!</em>

6 0
3 years ago
Read 2 more answers
You are installing several servers that will be used as web servers to reach customers over the Internet. Where should you place
just olya [345]

Answer: DMZ

Explanation:

 DMZ is the demilitarized zone network and it is use in providing he various services to the users or customers by using the public internet. It basically contain organizational services in the logical and physical sub-network and usually works in large network.

The main purpose of DMZ that it is use as web server over the internet for reaching to the users and customers. It also add one additional layer in the organization for security purpose.

Some of the services that DMZ provides as web server, DNS and proxy server.  

4 0
3 years ago
What is a limitation of 5G mmWave, despite its high speed?
Allushta [10]

The limitation of 5G mmWave, despite its high speed, is the fact that they have a short range.

  • 5G simply means the fifth generation of wireless technology that has great speed and provides connectivity to cellphones.

  • mmWave is the higher frequency radio band that is very fast. It should be noted that the 5G mmWave is super fast and is being used by large organizations to improve their work.

  • The main limitation of 5G mmWave is that for one to use it, one has to be close to the 5G tower. This is why it's hard for people living in rural areas to benefit from it unless it's situated close to them.

  • It should be noted that despite the fact 5G offers greater bandwidth, which is vital in relieving network congestion, there are still more improvements to be made in order for everyone to benefit.

In conclusion, the limitation of 5G mmWave, is that they have a short range.

Read related link on:

brainly.com/question/24664177

6 0
2 years ago
In Online Data Extraction data is extracteddirectly from the ------ system itself.o Hosto Destinationo Sourceo Terminal
barxatty [35]

Answer:

system itself.

Explanation:

In Online Data Extraction data is extracted directly from the system itself.

4 0
3 years ago
How to remove special formatting from a table in word.
ch4aika [34]

Answer:

Clear Format

Explanation:

7 0
2 years ago
Other questions:
  • If a user wants to change one small section of the formatting of a document and leave the rest the same, which process should be
    14·1 answer
  • The basic input/output system (bios locates the boot loader program on a linux system by reading the __________ on the hard driv
    13·1 answer
  • Which port-authentication network access control standard forces devices to go through a full authentication, authorization, and
    13·1 answer
  • What makes iron man different from other superheroes ? why is iron man the best superhero ??
    5·2 answers
  • Vhich economic impact of computers was mentioned in this lesson?
    6·1 answer
  • Write a pseudo-code that keeps asking the user for a given number 'n' different of zero, then print all numbers between one &amp
    8·1 answer
  • 1. What makes discrimination different from harassment? (Don't give me definitions.)
    5·1 answer
  • What's the answer plssss​
    10·1 answer
  • What what do these two parts of the lift do ​
    14·1 answer
  • Design algorithm and the corresponding flow chart for adding the subject score of 5, total value and rank.​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!