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
A(n) _______________ supplies one of the most critical aspects of docking stations, but in a smaller, more portable format: supp
baherus [9]

Answer:

A Port Replicators.

Explanation:

Port replicators are devices or extension. They are plugged into the laptop's usb port to provide extra ports to connect other external devices needed by the laptop.

Docking stations does the same thing, but the laptop is plugged into the docking station holding the needed devices, and meant for that laptop brand.

7 0
3 years ago
What is technology? Technology advantages and disadvantages
Alisiya [41]

Explanation:

Technology is a method or skill of utilizing scientific information to reach the goals that include computers, machines and also different techniques.

Advantage of using technology

  • Information can be quickly stored and shared very easily.
  • Technology is used in all companies and businesses to achieve the tasks in a short period with efficiency,
  • Technology has reduces the human errors that have helped to reduce the work stress.

Disadvantages of using technology

  • Corruption and terrorism have increased due to advancements in technology.
  • with the help of technology, digital and data manipulation is done.
  • Too much connected or dependent on technology can cause several psychological problems such as narcissism,depressions, distraction.
  • Using too much of technology can affect physical health such as vision problems, hearing problems, neck strain.

3 0
3 years ago
Choose the term that makes the sentence true.
Colt1911 [192]
The windows of death color is blue and with a sad face and says “your pc has ran to a problem and needs to restart. We’re just collecting some error info, and then we will restart it for you
8 0
3 years ago
You type a complex formula in cell A20. You would like to make the same calculation in cells B20 through H20. To be efficient, y
fomenos

Answer:

Use autofill

Explanation:

In excel "autofill" is used to fill data in cells, which follows the pattern or logic applied in other cells. To apply same calculation of A20 in B20 to H20, we use autofill technique. Instead of copy pasting, or manually entering the complex formula this method is more suitable.  

4 0
3 years ago
Read the underlined sentence on page 1.
olasank [31]

Answer:

It for shadows the reason that peles temper is not just a rumor wich is proven in the answer she gives

Explanation:

it says that you should forget the rumors and her fiery temper whic means ti is true

6 0
3 years ago
Other questions:
  • According to the family life course development framework, the __________ stage of the family life cycle comes to an end with th
    7·1 answer
  • How to connect to my wireless printer for dummies?
    12·1 answer
  • write an application to presell a limited number of cinema tickets. each buyer can buy as many as 4 tickets. No more than 100 ti
    8·1 answer
  • Clep allows students to do all of thw following except which?
    11·2 answers
  • A ________ is a virus that is triggered on a certain date.
    11·1 answer
  • What items should you evaluate when scouting the facilities at a shooting location?
    11·1 answer
  • Rick works for the government and is investigating a small business that the government suspects has been cheating on its taxes.
    15·1 answer
  • If your computer won't connect to the internet, which of these is most likely to be the problem?
    8·1 answer
  • What adaptation Judy and her parents have that help them run from predators coming?​
    6·1 answer
  • Which unit of the computer works as the input​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!