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
Wittaler [7]
3 years ago
6

TV show information can either keep track of the number of viewers per show or the name of a show. Information is kept in a file

(see sample files below). If the first line of the file says Show, we should store the names of the shows. If the first line of the file says Viewer, we should store the number of viewers per show.
Create a class to complete the program below.
int main(int argc, char** argv) Tv_show_info Tv_show_info show_names(argv[2]);
int n=viewers.info.at(0);
std::string s=show_names.info.at(0);

Sample input file 2: Viewer Sample input file 1: Show Stranger Things Game of Thrones Black Mirror 34 100

its not provided, we are to recreate it. but this is what i made..

template
class Tv_show_info
{
public:
// template
Tv_show_info(string & file):
filename{file}
{
ifstream myfile {filename};
vectorinfo;
T lines;
while (getline(myfile,lines))
{
info.push_back(lines);
}
}
private:
string filename;
};

Computers and Technology
1 answer:
Elza [17]3 years ago
3 0

Answer:

See explaination for Program source code.

Explanation:

The program source code below.

#include <iostream>

#include <fstream>

#include <vector>

using namespace std;

class Show

{

private:

string title;

int viewers;

public:

Show()

{

this->title = "";

this->viewers = 0;

}

Show(string title, int viewers)

{

this->title = title;

this->viewers = viewers;

}

string getTitle(){ return this->title; }

int getViewers(){ return this->viewers; }

};

int main()

{

vector<Show> shows;

vector<string> titles;

vector<int> viewers;

ifstream inFile1("file1.txt");

ifstream inFile2("file2.txt");

string line1, line2;

if(!inFile1.is_open() || !inFile2.is_open())

{

cout << "Either of the files could not be found!\n";

exit(0);

}

getline(inFile1, line1);

if(line1.compare("Show") == 0)

{

while(getline(inFile1, line1))

{

titles.push_back(line1);

}

inFile1.close();

}

getline(inFile2, line2);

if(line2.compare("Viewer") == 0)

{

while(getline(inFile2, line2))

{

viewers.push_back(stod(line2));

}

inFile2.close();

}

for(int i = 0; i < titles.size(); i++)

{

shows.push_back(Show(titles[i], viewers[i]));

}

// display all the show details

cout << "\nALL SHOWS:\n----------\n";

for(Show show : shows)

{

cout << "Title: " << show.getTitle() << ", Number of viewers: " << show.getViewers() << endl;

}

cout << endl;

return 0;

}

See attachment for output

You might be interested in
State the keyboard key used to move the cursor to the line​
irina [24]

Answer:

Home & End are used to move the cursor to the start and end of a line

4 0
3 years ago
Types of network model​
dexar [7]

Answer:

OSI Model and TCP/IP Model

Explanation:

4 0
2 years ago
What are the contents of memory locations 200, 201, 202, and 203 if the word 1234 is stored at offset 200 and the word 5678 is s
Igoryamba

Answer:

Data at the following addresses will be as following:-

200 :- 34

201 :- 12

202 :- 78

203 :- 56

Explanation:

If there is 1 byte storage.

if the data is of 4 digits.Then we have to store it in 2 memory locations.

The first two digits will be stored at the higher byte address that is 201 and the last two digits will be stored at then lower byte address that is 200.

The case is same with the next data 5678.

At address 202 :- 78 will be stored and at address 203 :- 56 will be stored.

3 0
3 years ago
.Draw the following sine wave in the time domain, showing amplitude and phase:
alexdok [17]

Answer with Explanation:

Part 1)

The given sine wave is as

y=3sin(2\pi t+\pi)

The graphical representation of the wave is shown in the attached figure:

Part 2)

For a general wave equation y(t)=Asin(\omega t+\phi )

'A' is defined as amplitude of the wave

(\omega t+\phi ) is defined as phase of the wave

Upon comparing with the given wave function we observe

1) Amplitude of the given wave is 3

2) Phase of the given wave (2\pi t+\phi )

7 0
3 years ago
Amy wants to controls the overall process of creating digital designs. Which career is Amy pursuing?
Hoochie [10]
Game designer

I hope this helped
8 0
3 years ago
Other questions:
  • Yesterday Hunter's laptop screen appeared to go black. The laptop was still running, but he could not see the desktop or any gra
    9·1 answer
  • A word or line of a paragraph at the top of a page hanging indent is called ______
    8·1 answer
  • To delete a database object, right-click the object in the Navigation Pane and then click ____ on the shortcut menu.
    15·1 answer
  • The process of encoding messages or information in such a way that only authorized parties can read it is called ____________.
    7·1 answer
  • The _____ search algorithm searches a list for a given item, starting with the first element and continues to compare the item w
    12·1 answer
  • . In testing, what is the role of an oracle?
    15·1 answer
  • When you are saving a file, what does word suggest by default as the name of the document?
    8·2 answers
  • 1.) Florida has ____________ roads that are designated as part of the National Highway System.
    12·1 answer
  • Create the following SQL Server queries that access the Northwind database. Place them in a zip file and place the zip file in t
    6·1 answer
  • Sustainable development is a goal towards which all human societies need to be moving. elaborate the statement in about 120 word
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!