Help: Need to translate code from C + + to Java

Code with C | Programming: Projects & Source Codes Forums C and C++ Help: Need to translate code from C + + to Java

This topic contains 3 replies, has 1 voice, and was last updated by  Adelaid 2 years, 5 months ago.

  • Author
    Posts
  • #11161

    Here is code:

  • #11162

    Amit
    Member

    Some logical errors in the below – struggled to convert some of your logic, see the comments for where these issues are. The code will compile though.

  • #11163

    SapnaVishwas
    Member

    A bread is being sold at the bakery. At the start of the day n bread are baked each of them with quality x. As time passes new bread are baked with various qualities, customers come in and buy the bread. When a customer comes to the salesperson: “Give me the best bread you’ve got!” The salesperson takes the best bread and sells it to the customer. Help the bakery to have better bussiness by always selling their customers the best bread. n(1< =n<=100000) is given and after that n numbers x. The number x describes the quality of the bread. The number m follows after that, then m(1<=m<=100000) numbers y. y describes the events during the day. If y is zero. it means that a customer came and bought the best bread , so it has to write out the quality of the sold bread or "No" if there is no bread. If y isn't zero, it means that a new bread has been baked of the quality y which can be bought from that moment on.

    Input:
    5
    15 32 4 18 29
    12
    0 0 50 0 24 97 0 0 0 0 0 0
    Print:
    32 29 50 97 24 18 15 4 No

  • #11164

    Adelaid
    Member

You must be logged in to reply to this topic.