Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 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.

  • This Question is Closed
  1. bahrom7893
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    1 Attachment
  2. bahrom7893
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    1 Attachment
  3. bahrom7893
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 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

  4. bahrom7893
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 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?

  5. bahrom7893
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    @estudier

  6. bahrom7893
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    same here.. i have no darn clue what the heck the prof wants.. I'll prolly go talk to him on monday...

  7. bahrom7893
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    yea, he mixed up the account numbers.

  8. bahrom7893
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 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..

  9. mohd.jas
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 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'.

  10. oldrin.bataku
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 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.

  11. mohd.jas
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    @oldrin.bataku : So it is basically like a linked list, yeah? I'm not very well-versed with C++.

  12. oldrin.bataku
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 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).

  13. mohd.jas
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    Oh, okay. I just read more on it now. Can see the difference. :) Thanks!

  14. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Ask a Question
Find 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
  • 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.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.