Ask the user for a filename that contains one string of at least 6 words (the words are separated by spaces). Use a for loop to read the first five words, and save them into a second file named "words.txt". So, if the first file contains this string: Homer Simpson should be president of the United States of America Then your second file will contain: Homer Simpson should be president

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter6: Looping
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Hi, I need to solve this problem with C++ programming language using Visual Studio. Thank you.

 

Prog2
Ask the user for a filename that contains one string of at least 6 words (the words are separated by
spaces). Use a for loop to read the first five words, and save them into a second file named "words.txt".
So, if the first file contains this string:
Homer Simpson should be president of the United States of America
Then your second file will contain:
Homer
Simpson
should
be
president
Transcribed Image Text:Prog2 Ask the user for a filename that contains one string of at least 6 words (the words are separated by spaces). Use a for loop to read the first five words, and save them into a second file named "words.txt". So, if the first file contains this string: Homer Simpson should be president of the United States of America Then your second file will contain: Homer Simpson should be president
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Introduction to computer system
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning