Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include using namespace std; int main ( ) { ofstream ofile; string input, separated; ofile.open ( phrases . txt ) ; cout

#include
#include
using namespace std;
int main()
{
ofstream ofile;
string input, separated;
ofile.open("phrases.txt");
cout << "Type the sentence (no spaces): ";
cin >> input;
separated = input[0];
for (int i =1; i < input.length(); i++){
char ch = input[i];
if (ch >='A' && ch <='Z'){
separated +='';
ch =(char)(ch -'A'+'a');
}
separated += ch;
}
cout << "Separated: "<< separated << endl;
ofile.close();
return 0;
} Modify the above program in C++ so it will accept several inputs until the user types STOP. All the sentences must be written to the file "phrases.txt".

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Structure Of The Relational Database Model

Authors: Jan Paredaens ,Paul De Bra ,Marc Gyssens ,Dirk Van Gucht

1st Edition

3642699588, 978-3642699580

More Books

Students also viewed these Databases questions

Question

define the term outplacement

Answered: 1 week ago

Question

describe the services that an outplacement consultancy may provide.

Answered: 1 week ago