-
May 28th, 2010, 12:38 PM
#1
Searching and sorting
Hello, any help of any kind will be very much appreciated.
I've done the other part of the question but my code is actually useless without this first part
here it is:
"Write down a function that accepts a set of products names that are avilable in a stock;
their unit prices and no of units sold from each stock in four periods in a year. Assume that there can be 100 different items in the stock.Then find the amount of sales of each product and the total amount of sales..."
The other part involves sorting and searching for specific products info but i'm okay with that. I could also use structures but i'm asked to use functions and i need some help with that.
Thanks..
-
May 28th, 2010, 01:54 PM
#2
Re: Searching and sorting
You're going to need a struct or class representing the products and a container to hold them. I don't know if their use of the word "set" there is to be taken literally or not. Do you have the product class written yet and an appropriate container selected?
-
May 28th, 2010, 02:02 PM
#3
Re: Searching and sorting
no i dont actually, i didnt try that coz the question said i use a function..
-
May 28th, 2010, 02:37 PM
#4
Re: Searching and sorting
Originally Posted by shani09
no i dont actually, i didnt try that coz the question said i use a function..
Read the entire requirement. My post still stands.
-
May 28th, 2010, 05:04 PM
#5
Re: Searching and sorting
yeah i know you're right and i also know using a class or struct is a possible solution but i want help on how to use a function for the same solution.. that's what the question is really all about
-
May 28th, 2010, 06:52 PM
#6
Re: Searching and sorting
Originally Posted by shani09
yeah i know you're right and i also know using a class or struct is a possible solution but i want help on how to use a function for the same solution.. that's what the question is really all about
The two are unrelated concepts. You need a struct or class and a container full of them to pass to the function. The function "accepts a set of products names that are avilable in a stock; their unit prices and no of units sold from each stock in four periods in a year.
How do you think you're going to pass all that stuff to the function?
-
May 29th, 2010, 04:53 AM
#7
Re: Searching and sorting
i dont know that's why i'm asking.....
-
May 29th, 2010, 06:18 AM
#8
Re: Searching and sorting
Originally Posted by shani09
i dont know that's why i'm asking.....
And that's why I'm telling you. It's isn't really clear to me though if "Write down a function that accepts a set of products" means the function accepts the input from the user, or that's what gets passed to the function as an argument.
-
May 29th, 2010, 02:29 PM
#9
Re: Searching and sorting
okay then... i'll try to write it using structures...
-
May 29th, 2010, 02:30 PM
#10
Re: Searching and sorting
Although it was a past exam question i got from a friend
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|