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
If a Web page is not copyright protected, then it is ethical to cut and paste sections of the page into your speech without citi
JulijaS [17]

Answer:

False.

Explanation:

Even if the web page does not have copyright protection it is unethical to cut and paste sections of the page into your speech without citing the source.It is definitely plagiarism.You are copying content from other sources and representing the mas your own.So we conclude that the answer is false.

5 0
3 years ago
Prove that the dual of the exclusive-OR gate is also itscomplement
Tresset [83]

Answer:

Explanation:

The dual of a function means replace AND with OR and replace OR with AND.

XOR gate of A , B is

A \, XOR\, B = AB' + A'B

So, Dual of A XOR B is ( replace AND with OR and OR with AND)

= (A+B')(A'+B)

Complement of A XOR B is (A XOR B) ' = (AB' + A'B) ' = ((A)' + (B')') ((A')' + (B)') = (A'+B)(A+B') (In finding compliment AND becomes OR and OR becomes AND ).

By inter changing the above product of terms  

Complement of A XOR B = (A + B') (A' + B)

So, Dual of A XOR B = Complement of A XOR B.

7 0
3 years ago
A set of connected ideas supported by examples is ?
andrezito [222]

Answer:

Argument

Explanation:

<u>Argument</u> - A set of connected ideas, supported by examples, made by a writer to prove or disprove a point.

5 0
2 years ago
Read 2 more answers
Which of the following keys on a keyboard allows you to select multiple cells located in different parts of your worksheet?
MrMuchimi
<span>Hold down the Ctrl key as you click the cells you would like to select.</span>
5 0
2 years ago
Read 2 more answers
Hi, I need help on a Circle Class Assignment that is due today. If anyone could please help me, I would greatly appreciate it. I
nikklg [1K]

Answer:

hmmm lets see

Explanation:

7 0
3 years ago
Other questions:
  • Search engines enable you to
    13·2 answers
  • Which of these automotive repair areas helps the vehicle change speeds to operate efficiently under all conditions?
    5·1 answer
  • An email message form includes all of the following main areas except
    11·2 answers
  • What is secondary exchange ? - Apex
    14·1 answer
  • I just want to ask if some one know an online school program that offer a live session and the cost of it not to expensive. for
    10·1 answer
  • In regard to protective actions for explosive devices, the area where the blast originates is referred to as ___________ perimet
    8·1 answer
  • Laura wants to know more about the organization to which she has applied. What can she do to know more about the organization’s
    12·1 answer
  • Guys how can i video my self from my laptop <br> my laptop is (lenovo)
    8·2 answers
  • 16. A/An __________ is operated on the principle that the dying have special needs and wants that hospital personnel are too bus
    15·2 answers
  • The following is a function:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!