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
Mrs. Dunn shows her students a data range, which has been named "Goals," covering cells A14 to A25. She tells her students that
Butoxors [25]

Answer:

Hina and Riko; the dialog box is inside the Name Manager group, and it allows the user to manually type in the additional cells or select the cells after clicking the collapse button.

3 0
3 years ago
Which menu would most likely allow you to choose a font A.file B.Edit C.format D.insert​
Ksivusya [100]

Answer:

D

Explanation:

7 0
2 years ago
Explain the role of ICT in banks​
vladimir1956 [14]

Answer: ICT help banks improve the efficiency and effectiveness of services offered to customers, and enhances business processes, managerial decision making, and workgroup collaborations, which strengthens their competitive positions in rapidly changing and emerging economies.

Explanation: please give branliest I only need one more to make ace

7 0
2 years ago
AtlasNow Construction Company, a general contractor, plans to place a bid for building a hospital. It requests bids from subcont
Lorico [155]

Promissory estoppel legal doctrine can help AtlasNow from being meted out injustice due to lack of consideration

<h3><u>Explanation:</u></h3>

Promissory estoppel is a concept in contract law that hinders a person from running backward on a promise yet if a legal contract seems not to endure. It declares that an aggrieved party can redeem losses from a promisor if the losses acquired were the consequence of a promise tendered by the promisor, which he relied on to his succeeding loss.

Promissory estoppel is assigned to hold the promisor from claiming that an underlying promise should not be lawfully propped or forced. It assists injured parties to overcome on promises performed that have commenced to economic loss when not met.

7 0
3 years ago
Compare the applications below:
Karo-lina-s [1.5K]
The answer is the first response, by order of elimination, you can eliminate the rest.

HTML is a programming language that is used to design websites. You don't need to program a website to make a post on instagram, especially if you are using the app.

If you check the app store on your phone, you can find instagram in the app store, which lets you access it from your mobile device. Thus, the third option is wrong.

Finally, just read the description of instagram. It was made for sharing pictures, so the last option is wrong.
3 0
3 years ago
Other questions:
  • How to delete audio from powerpoint​
    13·1 answer
  • Name a computer programme that designers are likely to use to create a leaflet advertising their new product
    15·1 answer
  • Jordan has been asked to help his company find a way to allow all the workers to log on to computers securely but without using
    6·1 answer
  • Conduct online research to determine specific conflict-resolution and management techniques and skills that would be beneficial
    5·1 answer
  • More recent GPU families such as Fermi and Kepler have adopted CPU-style virtual memory architecture with a____________-bit virt
    8·1 answer
  • One page of content in a PowerPoint presentation is referred to as a
    12·1 answer
  • Choose the parts of the browser window. PLEASE ANSWER QUICKLY TEST
    12·2 answers
  • Project light with a system of lenses used for projecting slides or film into a screen.
    5·1 answer
  • Kinda strange, and im good
    11·2 answers
  • When one loop appears inside another, the loop that contains the other loop is called the ____ loop. Group of answer choices ind
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!