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
katrin [286]
3 years ago
12

p25: File Write and Read1) User enters a file name (such as "myMovies.txt").2) User enters the titles of 4 of their favorite mov

eis (use a loop!).3) Program Writes the 4 titles to a file, one per line, then closes the file (use a loop!).4) Program Reads the 4 titles from "myMovies.txt" stores them in a list and shows the list5) The program writes the titles in reverse order into a file "reverseOrder.txt"Sample Run:Please enter a file name: myMovies.txtPlease enter a movie title #1: movie1Please enter a movie title #2: movie2Please enter a movie title #3: movie3Please enter a movie title #4: movie4Writing the 4 movie titles to file 'myMovies.txt'Reading the 4 movie titles from file into a list: [movie1, movie2, movie3, movie4]Writing the 4 movie titles in revers to 'reverseOrder.txt'Note: Do not use reverse() , reversed()Content of myMovies.txt:movie1movie2movie3movie4Content of reverseOrder.txtmovie4movie3movie2movie1
Computers and Technology
1 answer:
SCORPION-xisa [38]3 years ago
6 0

Answer:

<em>The program goes as follows  </em>

<em>Comments are used to explain difficult lines</em>

#include<iostream>

#include<fstream>

#include<sstream>

#include<string>

using namespace std;

int main()

{

//Declare String to accept file name

string nm;

//Prompt user for file name

cout<<"Enter File Name: ";

getline(cin,nm);

//Create File

ofstream Myfile(nm.c_str());

//Prompt user for 4 names of movies

string movie;

for(int i = 1;i<5;i++)

{

 cout<<"Please enter a movie title #"<<i<<": ";

 cin>>movie;

 //Write to file, the names of each movies

 Myfile<<movie<<endl;

}

Myfile.close(); // Close file

//Create an Array for four elements

string myArr[4];

//Prepare to read from file to array

ifstream file(nm.c_str());

//Open File

if(file.is_open())

{

 for(int i =0;i<4;i++)

 {

  //Read each line of the file to array (line by line)

  file>>myArr[i];

 }

}

file.close(); // Close file

//Create a reverseOrder.txt file

nm = "reverseOrder.txt";

//Prepare to read into file

ofstream Myfile2(nm.c_str());

for(int j = 3;j>=0;j--)

{

 //Read each line of the file to reverseOrder.txt (line by line)

 Myfile2<<myArr[j]<<endl;

}

Myfile2.close(); //Close File

return 0;

}

See attached for .cpp program file

Download cpp
You might be interested in
High Frequency Traders are
Alex73 [517]

Answer:

Firms that use high-speed computers and communications networks to execute millisecond trades for themselves

Explanation:

High Frequency traders are different entities that take part in the market that use powerful computers to be able to be fast at answering to news and have a big number of trades. These traders use advance tools to evaluate the markets and anticipate trends quickly to obtain profits from the trades they make. According to this, the answer is that High Frequency Traders are Firms that use high-speed computers and communications networks to execute millisecond trades for themselves.

7 0
3 years ago
Describe the tools that are required to accomplish each step in the data management process.
RideAnS [48]

Answer: The tools which are required to accomplish each step in the data management process are:

1. Cloud Data Management tools.

2. Master Data Management (MDM) tools.

3. Reference Data Management (RDM) tools.

4. ETL tools.

5. Data visualization and  analytics tools

Explanation:

Cloud Data Management tools with the help of various API's are able to connect multiples system with their data to the cloud. examples are amazon cloud, google API cloud.

MDM tools are used for creation and maintenance of reference data. example are Profisee

RDM tools is used with the MDM tools and are use to define the businesss processes over the reference data. Examples are Collibra.

ETL tools helps to load data of an organisation to data warehouses after transformation and testing the data pipeline constituting the data from different databases.

Data visualization  analytics tools helps to extract and generate report from the big sets of data which can help an organisation to take business decisions.

6 0
3 years ago
Read 2 more answers
Four categories of installer apps
Naddika [18.5K]

Answer:

I find 5 categories

Explanation:

1 Overview

2 Necessity

3 Types

4 Attended installation

4.1 Silent installation

4.2 Unattended installation

4.3 Headless installation

4.4 Scheduled or automated installation

4.5 Clean installation

4.6 Network installation

5 Installer

5.1 Bootstrapper

5.2 Common types

5.3 System installer

7 0
3 years ago
Three PCs are on an Ethernet LAN, connected by a hub. Describe how the Ethernet protocol deals with collisions in this situation
sdas [7]

Answer:

All the ports in a hub are in the same collision domain and a hub sends frames from one host to all other hosts in the network. This makes it prone to collision and poor network throughput. Just like a network switch, it uses the CSMA/CD protocol to detect collision in its network.

A network switch reduces its collision domain to just a port and sends frames from one host to another using its mac table as a route. This makes the network very efficient with high throughput. It also uses the CSMA/CD protocol to detect collision

Explanation:

Switches and hubs are used in networking to connect computer devices in a network. A hub is an obsolete device networking that broadcast a frame to all other ports or host in the network except for the send host port. This increases the rate of collision as all the ports in a hub share the same collision domain. A switch is an efficient frame switching device in a network, which uses its MAC table to decide and find a destination host.

CSMA/CD is a collision detection protocol used in a network to detect and prevent a collision. With this protocol, a host is able to listen, wait, send and resend frames to prevent a collision.

3 0
3 years ago
A _____ is a specially formatted file that, once mounted, or connected to a virtual machine appear and operate pretty much ident
Sever21 [200]

A <u>Virtual hard disk</u> is a specially formatted file that, once mounted, or connected to a virtual machine appear and operate pretty much identically to a physical hard drive.

<h3>What is a virtual hard disk?</h3>

A virtual hard disk (VHD) is a disk picture file format for storing the entire ranges of a computer's hard drive.

The disk image, sometimes called a virtual machine (VM), duplicates an existing hard drive, including all data and structural elements.

<h3>Why would you count a virtual hard disk?</h3>

Typically, a VHD comes in handy to add additional storage to a Hyper-V virtual machine, and thanks to its capacity to support other OS installations, you can even use this storage virtualization technology to make a dual-boot system without modifying an existing partition.

To learn more about  virtual hard disk , refer

brainly.com/question/4733444

#SPJ4

4 0
1 year ago
Other questions:
  • Briefly describe "SoftwareEngineering Framework". Do provide examples and diagrams wherenecessary.
    15·1 answer
  • Routers: operate at the application layer operate only at the physical layer cannot connect two or more networks that use the sa
    5·1 answer
  • 1. When the Cisco 2950 switch is first turned on, it behaves like a hub. Why is this so, and what must happen before the switch
    5·1 answer
  • me pueden ayudar con mi trabajo sii porfss si me dan la respuesta correcta y les doy la mejor coronita si​
    12·1 answer
  • 1. What type of malware is triggered by a specific condition, such as a specific date or a particular user account being disable
    6·1 answer
  • WHAT DOES THE SCRATCH CODE BELOW DO?
    7·1 answer
  • The average American has 10 devices, ask for users average number of devices. Any number between 7 and 12 will print “you have a
    13·1 answer
  • Identify when programmers use an Else statement.
    15·2 answers
  • Choose the answer that best completes the visual analogy.
    11·1 answer
  • ____ characterized the period now known a Web 1. 0. Augmented reality
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!