#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <ctime>
#include <cstdlib>
using namespace std;
class information
{
public:
string name;
int month;
int day;
int year;
int balance;
};
struct Comp {
bool operator()(const information&a, const
information &b) {
if (a.year == b.year)
{
if (a.month ==
b.month)
{
return a.day > b.day;
}
}
else
{
return a.year
> b.year;
}
}
};
int main()
{
information person[63];
int RNG;
person[0].name = "angel", person[0].month = 5,
person[0].day = 8, person[0].year = 1996, person[0].balance =
30,
person[1].name = "legna", person[1].month = 7,
person[1].day = 5, person[1].year = 2000, person[1].balance =
40;
person[2].name = "Martin", person[2].month = 4,
person[2].day = 4, person[2].year = 1997, person[2].balance =
50;
person[3].name = "Dominick", person[3].month = 2,
person[3].day = 2, person[3].year = 1985, person[3].balance =
1436;
person[4].name = "Juditch", person[4].month = 6,
person[4].day = 25, person[4].year = 1967, person[4].balance =
6585;
person[5].name = "Cheryl", person[5].month = 10,
person[5].day = 20, person[5].year = 1971, person[5].balance =
1991;
person[6].name = "Gina", person[6].month = 5,
person[6].day = 5, person[6].year = 2010, person[6].balance =
4050;
person[7].name = "Marco", person[7].month = 2,
person[7].day = 24, person[7].year = 2004, person[7].balance =
4514;
person[8].name = "William", person[8].month = 11,
person[8].day = 9, person[8].year = 1989, person[8].balance =
5412;
person[9].name = "Marjorie", person[9].month = 7,
person[9].day = 26, person[9].year = 1985, person[9].balance =
6553;
person[10].name = "Neal", person[10].month = 5,
person[10].day = 8, person[10].year = 1961, person[10].balance =
1917;
person[11].name = "Kathy", person[11].month = 10,
person[11].day = 20, person[11].year = 1971, person[11].balance =
4396;
person[12].name = "Pattie", person[12].month = 12,
person[12].day = 5, person[12].year = 2007, person[12].balance =
159,
person[13].name = "Darron", person[13].month = 8,
person[13].day = 5, person[13].year = 1952, person[13].balance =
7694;
person[14].name = "Meri", person[14].month = 4,
person[14].day = 16, person[14].year = 1976, person[14].balance =
2436;
person[15].name = "Mariann", person[15].month = 12,
person[15].day = 7, person[15].year = 1966, person[15].balance =
3756;
person[16].name = "Manuela", person[16].month = 1,
person[16].day = 17, person[16].year = 1978, person[16].balance =
4011;
person[17].name = "Angelita", person[17].month = 4,
person[17].day = 30, person[17].year = 1944, person[17].balance =
1000;
person[18].name = "Nida", person[18].month = 1,
person[18].day = 16, person[18].year = 1980, person[18].balance =
7411;
person[19].name = "Vanetta", person[19].month = 6,
person[19].day = 3, person[19].year = 2013, person[19].balance =
7956;
person[20].name = "Gussie", person[20].month = 9,
person[20].day = 21, person[20].year = 1997, person[20].balance =
7113;
person[21].name = "Jaymie", person[21].month = 10,
person[21].day = 8, person[21].year = 1957, person[21].balance =
7936;
person[22].name = "Mitsuko", person[22].month = 9,
person[22].day = 6, person[22].year = 1960, person[22].balance =
177;
person[23].name = "Shirly", person[23].month = 6,
person[23].day = 12, person[23].year = 1946, person[23].balance =
1317;
person[24].name = "Luvenia", person[24].month = 6,
person[24].day = 10, person[24].year = 1950, person[24].balance =
30,
person[25].name = "Minda", person[25].month = 7,
person[25].day = 9, person[25].year = 1939, person[25].balance =
40;
person[26].name = "Carlo", person[26].month = 3,
person[26].day = 3, person[26].year = 1965, person[26].balance =
50;
person[27].name = "Clotilde", person[27].month = 9,
person[27].day = 25, person[27].year = 2013, person[27].balance =
1436;
person[28].name = "Luci", person[28].month = 12,
person[28].day = 10, person[28].year = 1944 , person[28].balance =
6585;
person[29].name = "Agnus", person[29].month = 12,
person[29].day = 16, person[29].year = 1937, person[29].balance =
1991;
person[30].name = "Magdalen", person[30].month = 10,
person[30].day = 30, person[30].year = 2006, person[30].balance =
4050;
person[31].name = "Mariana", person[31].month = 5,
person[31].day = 5, person[31].year = 2017, person[31].balance =
4514;
person[32].name = "Billie", person[32].month = 5,
person[32].day = 30, person[32].year = 1961, person[32].balance =
5412;
person[33].name = "Walter", person[33].month = 7,
person[33].day = 26, person[33].year = 1925, person[33].balance =
6553;
person[34].name = "Vincent", person[34].month = 7,
person[34].day = 10, person[34].year = 1961, person[34].balance =
1917;
person[35].name = "Jeannette", person[35].month = 11,
person[35].day = 20, person[35].year = 1933, person[35].balance =
4396;
person[36].name = "Noah", person[36].month = 12,
person[36].day = 13, person[36].year = 1973, person[36].balance =
159,
person[37].name = "Julian", person[37].month = 5,
person[37].day = 28, person[37].year = 2012, person[37].balance =
7694;
person[38].name = "Guadalupe", person[38].month = 9,
person[38].day = 16, person[38].year = 1921, person[38].balance =
2436;
person[39].name = "Melanie", person[39].month = 9,
person[39].day = 16, person[39].year = 1972, person[39].balance =
3756;
person[40].name = "Ramon", person[40].month = 8,
person[40].day = 20, person[40].year = 2007, person[40].balance =
4011;
person[41].name = "Toby", person[41].month = 8,
person[41].day = 25, person[41].year = 1993, person[41].balance =
1000;
person[42].name = "Stella", person[42].month = 1,
person[42].day = 16, person[42].year = 1980, person[42].balance =
7411;
person[43].name = "Bruce", person[43].month = 5,
person[43].day = 7, person[43].year = 1999, person[43].balance =
7956;
person[44].name = "Copper", person[44].month = 12,
person[44].day = 8, person[44].year = 2004, person[44].balance =
7113;
person[45].name = "Barnett", person[45].month = 3,
person[45].day = 21, person[45].year = 1958, person[45].balance =
7936;
person[46].name = "Warner", person[46].month = 7,
person[46].day = 23, person[46].year = 1987, person[46].balance =
177;
person[47].name = "Dennis", person[47].month = 8,
person[47].day = 30, person[47].year = 1984, person[47].balance =
1317;
person[48].name = "Sarah", person[48].month = 6,
person[48].day = 17, person[48].year = 1986, person[48].balance =
4349;
person[49].name = "Jerry", person[49].month = 8,
person[49].day = 4, person[49].year = 1968, person[49].balance =
6517;
person[50].name = "Anna", person[50].month = 7,
person[50].day = 8, person[50].year = 1951, person[50].balance =
2420;
person[51].name = "Carl", person[51].month = 2,
person[51].day = 25, person[51].year = 1950, person[51].balance =
2446,
person[52].name = "Anthony", person[52].month = 3,
person[52].day = 14, person[52].year = 1990, person[52].balance =
1528;
person[53].name = "Bobby", person[53].month = 9,
person[53].day = 14, person[53].year = 1951, person[53].balance =
3480;
person[54].name = "Clarence", person[54].month = 3,
person[54].day = 4, person[54].year = 2014, person[54].balance =
860;
person[55].name = "Marilyn", person[55].month = 4,
person[55].day = 15, person[55].year = 1998, person[55].balance =
7018;
person[56].name = "Paul", person[56].month = 5,
person[56].day = 28, person[56].year = 1939, person[56].balance =
6939;
person[57].name = "Martin", person[57].month = 3,
person[57].day = 14, person[57].year = 1920, person[57].balance =
4035;
person[58].name = "Jean", person[58].month = 2,
person[58].day = 7, person[58].year = 1934, person[58].balance =
7435;
person[59].name = "Mary", person[59].month = 12,
person[59].day = 25, person[59].year = 1952, person[59].balance =
4439;
person[60].name = "Teresa", person[60].month = 10,
person[60].day = 1, person[60].year = 1959, person[60].balance =
7867;
person[61].name = "Andrea", person[61].month = 1,
person[61].day = 11, person[61].year = 2005, person[61].balance =
2793;
person[62].name = "Edward", person[62].month = 4,
person[62].day = 14, person[62].year = 1924, person[62].balance =
2355;
priority_queue<information,
vector<information>, Comp> pq;
srand(time(NULL));
for (int i = 0; i < 10; i++)
{
RNG = rand() % (63 - 1) + 1;
pq.push(person[RNG]);
}
while (!pq.empty())
{
information r = pq.top();
pq.pop();
cout << "Name =
"<<r.name << " Month = " << r.month << "
Day = " << r.day << " Year = " << r.year <<
" Balance = " << r.balance << endl;
}
system("Pause");
return 0;
}
Can someone help me make my code better i am getting an error and i dont know how to fix it
c++
Below is your working c++ code :now it doesnt show any error
|
#include<iostream> class information struct Comp { int main() priority_queue<information, vector<information>,
Comp> pq; while (!pq.empty()) |
For every c++ code you must include some libraries :
for every program you must use : #include<iostream>
for every program using string you must use :#include<string>
for every program using priority queue you must use : #include<queue>
using namespace std is used so as to use 'cout' and 'cin' function directly without calling std.
#include <iostream> #include <queue> #include <string> #include <vector> ...
please determine the output in a simple form
#include <stdio.h> 2 3 //Item 02 4 int main() 5 6 7 8 9 10 int i for( i = 0 ; i < 5 ; i++ ) ifo 12 13 14 15 16 17 18 19 20 21 printf("A" printf("B"); if i > 2 ) printf("C"); 23 24 25 26 27 28 29 30 31 32 if( i 3) printf( "D") if>4) printf("E 34 35 36 37 38 39 40 41...
Write a program that, given a month and year, prints a calendar, such as June 2016 Su Mo Tu We Th Fr Sa 5 6 7 8 910 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 To find out the weekday of the first day of the month, call this function: Computes the weekday of a given date. @param year the year @param month the month (1=January 12=...
2. After building a scientific way for demand forecasting, Mary hoped Jason can propose the optimal inventory/ordering policies for these 4 products for the first week of 2018. The sale price/unit for each product is listed below: Product A =$230 Product B=$50 Product C=$5 Product D=$3 Jason decided to use ABC rule to classify these 4 products. ‘A’ category product(s) will have the target service level 95%. ‘B’ product(s) will have the target service level 90% and ‘C’ products(s) will...
Game
Point_Differential Assists
Rebounds Turnovers Personal_Fouls
1 15 15 38
11 9
2 36 20 43
8 13
3 16 21 29
7 13
4 45 22 46
11 11
5 12 11 40
7 22
6 -10 10 31
13 26
7 11 19 45
11 7
8 12 16 32
16 14
9 3 16 27
18 15
10 19 9 34
17 17
11 40 16 41
9 17
12 44 12 29
9 22
13 16 ...
Travel Data 10. Using your travel data: a. Develop a 95% confidence interval for your mean time to work (lunch) using time in minutes. b. What assumption is necessary for you to complete part (a)? Do you feel this assumption is valid? 119 B C A 1 TO WORK Time in Day of Week Minutes 2 Date Ce 2-Sep Monday 3-Sep Tuesday 4-Sep Wednesday 5-Sep Thursday 6-Sep Friday 9-Sep Monday 10-Sep Tuesday 11-Sep Wednesday 12-Sep Thursday 13-Sep Friday 16-Sep Monday...
Therefore, for this program you will read the data in the file named weatherdata_2.txt into arrays for the wind speed and for the temperature. You will then use the stored data to calculate and output the average wind speed and the average temperature. Create a constant with a value of 30 and use that to declare and loop through your arrays and as a divisor to produce your averages. Here is the data file (below). 1. 14 25 2. 12...
Task 2 Write a shell script program call cal3.sh to do the following. 1. Print the output "you must provide at least one month" when there is no argument 2. Print the calendar with specified month matching the argument when there is one argument $ ./cal3.sh 1 January 2016 Su Mo Tu We Th Fr Sa 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27...
if you arent able to get it exactly like the template thats
ok
Adjusted Trial Balance For the Month Ended June 30, 2020 Credit Adjusted Trial Balance Debit $ 3,712 3,904 480 Account Titles Cash Accounts Receivable Supplies Accounts Payable Unearned Service Revenue Owner's Capital Owner's Drawings Service Revenue Salaries and Wages Expense Miscellaneous Expense Supplies Expense Salaries and Wages Payable $ 1,382 160 5,760 550 4,300 1,260 256 1,900 $12,062 460 $12,062 Instructions (a) Prepare closing entries at June...
You have this solution in Java, I am interested in this same solution for Python.One interesting application of two-dimensional arrays is magic squares. A magic square is a square matrix in which the sum of every row, every column, and bothdiagonals is the same. Magic squares have been studied for many years, and there are some particularly famous magic squares. In this exercise you will write code todetermine whether a square is magic.You should find that the first, second, and...
a survey asked 50 baseball fans to report the number of games they attented last year. The results of the survey are presented below. Construct a histogram using the data. What can you tell about how the data is distributed given your histogram? 5 16 11 8 8 8 5 11 14 10 15 26 15 19 7 6 24 20 9 18 14 6 6 16 10 6 5 24 25 22 7 15 4 9 5 21 28...