[solved] – Question 76583
Question 1
Write a C++ program that contains the following functions
A function that takes in a 2D array with 5 rows and 6 columns, and has the user read in values to fill up the array
A function that takes in the 2D array and a parallel array and finds the largest element using row-major order and stores these elements in the corresponding location of the parallel array, as explained in class
A function that does the same as above using column-major order
A function to print the 2D array using row-major order
A function to print the 2D array using column-major order
A function that takes in a 1D array and it’s size and prints the entire array.
Use appropriate function calls in the main to display the 2D array in column and row major order, and the content of the 1D arrays
Expert Answer
[solved] – Question 76593
Write a function remove_odd that takes in a set of integers and removes all the odd elements.
Hint: you will need to use an iterator to iterate through the elements in a set.
Hint: In C++11, an auto keyword can be use to automatically infer the type. e.g. autoiter = s.begin()
#include <set>
using namespace std;
void remove_odd(set<int> s) {
//code
}
Expert Answer
[solved] – Question 76610
Player who has health (integer) and a position (structure). Position structure must have two values (int x and int y). Player’s health will be initialized to 100 and player’s position will be initialized to (8, 8).
The map which the player will move must be a 2D structure matrix. This matrix must have 15 rows and 15 columns. Each cell in the matrix should consist of two integer values. These integer values must be initialized to 0.
W up: Increases the y coordinate of the player by 1
S down: Decreases the y coordinate of the player by 1
A left: Decreases the x coordinate of the player by 1
D right: Increases the x coordinate of the player by 1
There must be 30 enemies and 10 tokens. Both token and enemy coordinates are all random. Damage value varies between 1 to 30 which should be set randomly. Values of tokens may differ between -5 to 10, 0 excluded. After initialization of the map these values must be placed into map.
Full assignment : https://www.dropbox.com/s/pvfws9n3sm0fumh/HW.doc?dl=0
Expert Answer
[solved] – Question 76703
Given the lists list1 and list2 that are of the same length, create a new list consisting of the last element of list1 followed by the last element of list2, followed by the second to last element of list1, followed by the second to last element of list2, and so on (in other words the new list should consist of alternating elements of the reverse of list1 and list2). For example, if list1 contained [1, 2, 3] and list2 contained [4, 5, 6], then the new list should contain [3, 6, 2, 5, 1, 4]. Associate the new list with the variable list3.
Expert Answer
[solved] – Question 76705
Write a function reverse, that takes in a vector<T> and returns a new vector<T> that has the contents reversed.
Try practising with and without using iterators.
Input: reverse({1, 2, 3, 4, 5})output:{5, 4, 3, 2}
Input: reverse({Lorem, ipsum, dolor, sit, amet})output: {amet, sit, dolor, ipsum}
Expert Answer
[solved] – Question 76714
Trying to code this but not working what am I missing
Using the logical operator for AND, fill in the if statement to check if even and odd are greater than 19.
let odd = 7;
let even = 20;
let greaterThan;
if(){
greaterThan = true;
} else {
greaterThan = false;
}
Expert Answer
[solved] – Question 7675
One large company pays its salesperson on a commission basis.The salesperson each receive 200 per week plus 9 percent of their gross sales for that week.Develop a c++ program that uses a while statement to input each salespersons gross sales for last week and calculates and displays that salespersons earnings.
Expert Answer
[solved] – Question 76766
Write a function named shopping() that enables Monica and Pheebe to shop. This function needs to ask to enter which
one is shopping, in which store, which products and how many of the product is purchased. The products that they can
purchase can be seen in following table:
Product 1: G Store=10 $ W Store=15 $
Product 2: G Store =12.5 $ W Store=17 $
Assume that they can only shop from Store G or Store W
At the beginning Monica got 100 TL and Pheebe got 120 TL
After each purchase, print the remaining money
If any of them do not have enough money to buy, print a warning message
They will continue shopping unless any of them spend all the money
Sample Run:
Which one is shopping :M
Which store : W
Which product,how monay : 1 4
Remaning money for monica : 40.00
Which one is shopping :M
Which store : G
Which product,how monay : 1 5
Not enough money!
Remaning money for Pheebe : 40.00
Expert Answer
[solved] – Question 76778
When creating a table in html, what marks the start and end of the table?
Expert Answer
[solved] – Question 7680
Write a function called plusTax that uses parameters that specify a price (in cents) and a tax rate (as a per?
Write a function called plusTax that uses parameters that specify a price (in cents) and a tax rate (as a percentage). The function calculates the amount of tax, and then adds the tax to the price and returns the total.
Note that the function must round the tax (and not truncate it). Thus, 100 cents w/ a tax rate of 4.2% is 104 cents, but 100 cents w/ a tax rate of 4.8% is rounded to 105 cents. Hint: cast the double to an int and use an if statement to decide whether or not to add a penny.
i need headerline help(prototype) and to write a function for it, so far i have this and i’m stuck, someone please help, thanks.
int cost = 100; //cost is 100 cents
double taxRate = 4.2; //tax is at 4.2 percent
cout << “With tax that is ” << plusTax (cost, taxRate) << ” cents.” << endl;
//output: With tax that is 104 cents.
taxRate = 4.8; //tax is at 4.8 percent
cout << “With tax that is ” << plusTax (cost, taxRate) << ” cents.” << endl;
//output: With tax that is 105 cents.
cout << endl;
note this is a C++ program.
Expert Answer

