akosiraff

Download: Resistor Sort C++

Jan 30th, 2013
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1.  
  2. Download: http://solutionzip.com/downloads/resistor-sort-c/
  3. STEP 1: Create a Multifile Project
  4. Create a new multifile project using the Resistor class developed
  5. in Week 1, and include a new main() test function.
  6. STEP 2: Modify the Resistor-Class Definition
  7. 1. Add a static data member of the class Resistor to keep
  8. track of the number of Resistor objects that are dynamically
  9. created. This will also be used to limit the number of objects
  10. that are dynamically created to the maximum array size of the
  11. pointer array in the test function main().
  12. 2. In the Resistor constructor, use a random-number
  13. generator to randomly assign a nominal resistance value to the
  14. object between 1,000 and 10,000 ohms. The resistance values are
  15. not required to be standard resistance values.
  16. STEP 3: Create the Test Function Main() and the Support Function
  17. 1. Create an array of pointers of type Resistor.
  18. 2. Use elements of the pointer array to allow the user to
  19. dynamically allocate memory and to instantiate objects of the
  20. Resistor class.
  21. 3. Use the indirect member-selection operator (pointer) in
  22. the test routine to access function members of the Resistor
  23. class.
  24. 4. Write a new, nonclass function called in function main()
  25. to sort the pointers to the Resistor objects in order from lowest
  26. nominal resistance value to highest, passing a pointer to the
  27. Resistor-object pointer as the only passed data argument.
  28. 5. Display the sorted Resistor objects according to the
  29. nominal resistance value, from lowest to highest.
  30. 6. Within the sorting function, use pointer arithmetic to
  31. access the individual Resistor objects.
  32. 7. Function main() should also ensure that there are no
  33. memory leaks when the program ends.
  34.  
  35. Download: http://solutionzip.com/downloads/resistor-sort-c/
Add Comment
Please, Sign In to add comment