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]
2 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]2 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
Some financial institutions can be really bad about putting unexpected charges
kherson [118]
I think it’s false ............
7 0
3 years ago
Answer this question for points lol
Zanzabum

Explanation:

jxjxnxnxnxkxozj nxkakthanksssssss lolll

8 0
2 years ago
Read 2 more answers
A ____ transmits all data received to all network devices connected to it, regardless of which device the data is being sent to.
Alecsey [184]

A Hub transmits all data received to all network devices connected to it, regardless of which device the data exists being sent to.

<h3>What is Hub?</h3>

A hub stands for the connection point in a computer device where data from numerous directions converge and are then sent out in many directions to respective devices. A hub may even act as a switch by preventing distinct data packets from proceeding to a destination. There exist three types of network hubs: passive, active, and intelligent.

A network hub exists as a node that broadcasts data to every computer or Ethernet-based device connected to it. A hub stands less sophisticated than a switch, the latter of which can isolate data transmissions to specific devices. Network hubs stand best suited for small, simple local area network (LAN) environments.

Hence,  A Hub transmits all data received to all network devices connected to it, regardless of which device the data exists being sent to.

To learn more about Hub refer to:

brainly.com/question/25804256

#SPJ4

7 0
1 year ago
Whats the answer to this question?
Naddika [18.5K]
Eat a a dong dong edi35(
6 0
3 years ago
What is the disadvantages of using proprietary software
Snezhnost [94]

Answer:

Cost. One of the biggest drawbacks of any proprietary software is the licensing fee. ...

Developer Support. ...

Security Issues. ...

Customization.

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • Before sharing a document, you must first save the document to
    12·1 answer
  • How can you tell if a website is secure
    13·1 answer
  • Write a program in python that ask the user to enter a word and then capitalizes every other letter of that word
    15·1 answer
  • The CUSTOMERS and SALES tables contain these columns:
    6·1 answer
  • What are listed in the vertical columns across the top of the Event Editor?
    5·2 answers
  • How to format the selected range of cells as u.s currency
    6·1 answer
  • Meaning of ‘integrity of data’
    14·2 answers
  • Does anyone have Rblx? if so write your username
    6·1 answer
  • What happens on your screen when you click on the eyedropper tool in Scratch? The background of your scene will become transpare
    7·1 answer
  • ____ the most popular word processing applications software<br><br>​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!