You will be simulating a television company using a Greedy method to select whic
ID: 3818460 • Letter: Y
Question
You will be simulating a television company using a Greedy method to select which advertisements to show on their four channels in c++.
You will need to find a way to fit the advertisements that will produce the most profit.
You will need to find a way to fit the most advertisements.
Note: They may or may not be the same.
You will implement two versions. The first version will make the decision of rather this advertisement will show on one of the channel or not while it is reading in from the file. The second version will make the decisions after it read the whole file.
The input file is formatted as such:
53 68 0 0111
int1 tab int2 tab int3 tab int4 space int5 space int6 space int7 new_line int1 – The starting time
int2 – The ending time
int3 – The profit
int4 – Boolean value for channel 1
int5 – Boolean value for channel 2
int6 – Boolean value for channel 3
int7 – Boolean value for channel 4
0 means it cannot be on that channel while 1 means it can be on that channel.
There are 5000 advertisements in the input file.
Explanation / Answer
#include <iostream>
#include <string>
utilizing namespace sexually transmitted disease;
int fundamental()
{
string j;
string x = "1. Choice 1";
string x1 = "2. Choice 2";
string x2 = "3. Choice 3";
cout << "please select from the menu " << endl;
cout << x << endl;
cout << x1 << endl;
cout << x2 << endl;
cin >> j;
if(j == x)
{
cout << "You have chosen the alternative " << j;
}
else if(j == x1)
{
cout << "if - x1 = You have chosen the alternative " << j;
}
else
{
cout << "if - x2 = You have chosen the alternative " << j;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.