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
Intel Centrino Technology is the combinatin of wirelesstechnology with the previous HT technology.
Kay [80]

Answer:

<u>False</u>

Explanation:

Great question, it is always good to ask away and get rid of any doubts that you may be having.

The Intel Centrino Technology is a product marketed and sold by the tech giant Intel, which offers a combination of their Wi-Fi and WiMax technologies in a single personal laptop. It does not offer Hyper threading Technology (HT) like some of the other Intel branded CPU's. Some of the CPU's that include hyper threading are the Core I3 series.

Therefore, based on the information stated above, we can see that the statement in the question in <u>False</u>.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

7 0
2 years ago
What is the purpose of flight simulator programs, and what are some of the benefits of using them?
saw5 [17]

Answer:

Flight simulators provide a cost-effective way for pilots to practice both routine and rarely-used skills. With simulator training, you can refine your skills in a variety of different flight scenarios that can be tailored to your specific goals.

Explanation:

hope this helps <3

6 0
2 years ago
Read 2 more answers
This operator represents the logical AND.
sdas [7]

Answer:

C. &&

Explanation:

Of the options provided:

A) ++ : increment operator. For example : ++1 = 2

B) || : Logical OR operator. A || B is true if any one of A or B is true.

C) && : Logical AND operator. A && B is true if both A and B are true.

A            B         A && B

False    False      False

False    True       False

True     False      False

True     True        True

D) @ : Ampersand character (commonly used in email addresses) e.g, [email protected]

3 0
2 years ago
What is a stored​ procedure?
pshichka [43]

Answer:

The right answer is Letter B. It is an area of memory that is used for dynamic memory allocation.

Explanation:

<em>Because a store procedure is not a computer program,neither a computer software . It is a type of code or subroutine available to applications that access a relational database management system. Such procedures are stored in the database data dictionary. It serves to save time and memory, extensive  or complex processing that requires execution of several SQL. </em>

6 0
3 years ago
Is Bob Lazar telling a lie/withholding information?
Anon25 [30]

Answer:

I think he may be a nut, but I'm not sure, there's little evidence of what he says to be true.

6 0
3 years ago
Other questions:
  • What type of hardware and software does Instagram use?
    9·2 answers
  • Mation about which osi layers of connected cisco devices can be verified with the show cdp neighbors comm
    15·1 answer
  • Name that red flag asigment
    15·2 answers
  • Which best describes rfid technology?
    5·1 answer
  • The breastbone or ________________ extends down the chest.
    5·1 answer
  • Select the three careers in the creative side of digital media.
    11·1 answer
  • Which memory can be removed from motherboard? RAM OR ROM?​
    11·1 answer
  • If you forget your privacy password what will you do if the ask this question what is the name of one of your teacher?​
    12·1 answer
  • Cyberbullying can negatively impact a victim’s <br> well-being.
    13·1 answer
  • Convertbinary(111100)to decimal​​​​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!