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
If you Owned a business, what part of Microsoft Office would you use the most and why, which would you use the least and why, an
snow_lady [41]
<h2>Answer 1 with Explanation </h2>

Microsoft Word would be the most used part of the Microsoft office because you can type letters and draft documents easily including company reports, budgets, presentations, proposals and plans. It can also assist you with essential forms by building a library such as invoices, statements, receipts, agendas and memos and apart from this, you can create a mailshot where you can send a letter to some or all of your customers.

<h2>Answer 2 with Explanation </h2>

Microsoft presentation is the least used part of the Microsoft Office because it can only be used to make any presentation which may not be in need most of the time as the business is to be productive and communicate effectively. It involves emailing, letter writing, create documents, and more. Therefore, that it is easier for you to manage or organize all the details or important statements in one way and save it to be used at a later time and it does not get misplaced.

<h2>Answer 3 with Explanation </h2>

Microsoft Excel can be utilized to create notes, record sales trends and other business data. It provides business with tools that they need to make the most out of the data and excel spreadsheets are commonly used in every business to display financial information. To create grids of text, numbers, and a formula involving calculations, Microsoft Excel can be used conveniently as it is used to record expenditures, income and plan budgets.

4 0
3 years ago
____ presents a comprehensive model for information security and is becoming the evaluation standard for the security of informa
nikdorinn [45]

Answer:

c. NSTISSI No. 4011

Explanation:

NSTISSI is an acronym for National Security Telecommunications and Information Systems Security Institute.

It is one of the standards set by the Committee on National Security Systems (CNSS), an intergovernmental agency saddled with the responsibility of setting policies for the security of the IT (information technology) security systems of the United States of America.

NSTISSI No. 4011 presents a comprehensive model for information security and is becoming the evaluation standard for the security of information systems.

Generally, all information technology institutions and telecommunications providers are required by law to obtain a NSTISSI-4011 certification or license because it is a standard for Information Systems Security (INFOSEC) professionals.

8 0
3 years ago
The scope of a variable is __________________
Goryan [66]

Answer:

The scope of a variable is where it can be read or modified.

6 0
2 years ago
A cast is required in which of the following situations? a. using charAt to take an element of a String and store it in a char b
notka56 [123]

Answer:

Option(d) i.e "storing a float in an int" is the correct answer for the given question.

Explanation:

  • Typecast is used for the changing the one datatype to the another datatype Their are two types of casting  

1 implicit

In this typecast we change the smaller datatype into the larger datatype.

For example

int to float  

2 Explicit  

In this typecast we change the larger datatype into the smaller datatype in an explicit manner.

For example

float to int.

  • in the given question we required the casting in the option(d) i.e "storing float in an int" That's why this option is correct and all other options are incorrect.
3 0
4 years ago
Identify the programming tool that uses symbols to show the sequence of steps needed to solve a programming problem.
lbvjy [14]

Main Answer:

Identify the programming tool that uses symbols to show the sequence of steps needed to solve a programming problem.Program flowchart

sub heading:

what is program flowchart?

Explanation:

1.flowchart is a graphical representation of an algorithm.

2.programmers often use it as a program planning tool to solve a problem

Reference link:

https://brainly.com

Hashtag ;

#SPJ4

7 0
2 years ago
Other questions:
  • 40 POINTS I NEED THESE ANSWERS ASAP GIVE ME THE RIGHT ASNWER AND ILL PUT YOU AS THE BRAINLIEST
    13·1 answer
  • Which of the following does NOT describe word processing?
    11·2 answers
  • 3.24 LAB: Seasons
    13·1 answer
  • Given the scenario, before leaving the office, you ask the CIO to provide which formal document authorizing you to perform certa
    11·1 answer
  • Explain the importance of determinism in an industrial LAN
    8·1 answer
  • The video game machines at your local arcade output coupons depending upon how well you play the game. You can redeem 10 coupons
    14·1 answer
  • Write a program to compute the sum of digits in a number given by the user. You must use your own function to compute the sum of
    6·1 answer
  • When you look directly at a camera lens, it may seen like there is only one lens, but entering light actually passes through a s
    12·1 answer
  • The platform in E-Learning refers to:
    9·1 answer
  • How to change your username in brainly​
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!