Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
bahrom7893
Group Title
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.
 2 years ago
 2 years ago
bahrom7893 Group Title
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.
 2 years ago
 2 years ago

This Question is Closed

bahrom7893 Group TitleBest ResponseYou've already chosen the best response.2
So 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
 2 years ago

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

bahrom7893 Group TitleBest ResponseYou've already chosen the best response.2
@estudier
 2 years ago

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

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

bahrom7893 Group TitleBest ResponseYou've already chosen the best response.2
i 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..
 2 years ago

mohd.jas Group TitleBest ResponseYou've already chosen the best response.1
I'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'.
 2 years ago

oldrin.bataku Group TitleBest ResponseYou've already chosen the best response.2
Your 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.
 2 years ago

mohd.jas Group TitleBest 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++.
 2 years ago

oldrin.bataku Group TitleBest ResponseYou've already chosen the best response.2
No, 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).
 2 years ago

mohd.jas Group TitleBest ResponseYou've already chosen the best response.1
Oh, okay. I just read more on it now. Can see the difference. :) Thanks!
 2 years ago
See more questions >>>
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.