A community for students.
Here's the question you clicked on:
 0 viewing
bahrom7893
 2 years ago
Need some help with C++.. I know you're not supposed to post your assignments here, but I don't want you to write the program. I'm just trying to understand the assignment.
bahrom7893
 2 years ago
Need some help with C++.. I know you're not supposed to post your assignments here, but I don't want you to write the program. I'm just trying to understand the assignment.

This Question is Closed

bahrom7893
 2 years ago
Best ResponseYou've already chosen the best response.2So far what I got from this is: A random person requests to buy a certain number of lots (100 shares), at a certain price per share. So, the total price would be: price per stock * (# of lots)/100

bahrom7893
 2 years ago
Best ResponseYou've already chosen the best response.2and i didn't follow anything else.. Is all the info supposed to go into some vector? Can someone give me a few pointers?

bahrom7893
 2 years ago
Best ResponseYou've already chosen the best response.2same here.. i have no darn clue what the heck the prof wants.. I'll prolly go talk to him on monday...

bahrom7893
 2 years ago
Best ResponseYou've already chosen the best response.2yea, he mixed up the account numbers.

bahrom7893
 2 years ago
Best ResponseYou've already chosen the best response.2i think it is.. im just not following what the program shld be doing.. And he's like use a vector, when he didn't even explain those. Not a big deal, i can read up on them, but still..

mohd.jas
 2 years ago
Best ResponseYou've already chosen the best response.1I'm not sure about the Vector part either (something like a linked list? *shrug*), but here's what I understood from the sample run: The 'bid' commands are from the buyers in the format 'bid account_number number_of_lots bid_price_per_lot'. Initially the offer price is 25, and the first two bids don't have an offer greater than or equal to this. The third bid, however, is at 27 per lot, so it's executed immediately. The next command 'offer', changes the offer price per lot, in the format 'offer new_price'. So after 'offer 24', we have the price set at 24. However from the earlier two bids, one of them has an offer that meets this price, so that is executed. Then 'offer 25' doesn't cause any more executions because none of the pending or current transactions match. And that's how it goes. The only thing left is what your professor meant by 'vector'.

oldrin.bataku
 2 years ago
Best ResponseYou've already chosen the best response.2Your professor is referring to an std::vector (see: http://en.cppreference.com/w/cpp/container/vector), a C++ standard library container. It is more flexible to use than an array and grows dynamically. You don't NEED to use an std::vector, but it provides functionality for the list of sales orders.

mohd.jas
 2 years ago
Best ResponseYou've already chosen the best response.1@oldrin.bataku : So it is basically like a linked list, yeah? I'm not very wellversed with C++.

oldrin.bataku
 2 years ago
Best ResponseYou've already chosen the best response.2No, a linked list is a different structure... though both can be used to implement a list. An std::vector generally stores an array that is reallocated when necessary to resize... the reason it can't be a typical linked list is because of the constraints the C++ standard places on the complexity of its operations. For example, random access in a linked list (std::slist, std::list) is O(n), while in an std::vector it is required to be O(1) (like an array).

mohd.jas
 2 years ago
Best ResponseYou've already chosen the best response.1Oh, okay. I just read more on it now. Can see the difference. :) Thanks!
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.