The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
here' a new assignments
Â
Chapter 5
Â
Write a program that generates random numbers between 1 and 10 and fill an array of size 20 with them. Have your program sort the array then output in order the number of occurrences of each random number generated. Use the STL sort function to sort your array.
Â
How to use the STL sort:
Â
#include <algorithm>
...
int a[20]
...
sort(a,a+20);
Â
Â
Â
Chapter 6
Â
Write a class that represents a player in a game. The player should have a name, password, experience points, an inventory array of four strings, and a location x,y. Your class should have mutator and accessor methods for all variables. For example: setName(), getName(). It should have a suitable display method. Mutators and accessors should be public but all variables should be private. To implement get inventory, use string * getInv(); Use the scope resolution operator to implement larger methods such as display(). Use in class methods for shorter methods such as setName(), getName().
Â
Â
also going to attach both chapters files , with outputs
Â
Â
Â
Â
Â
Chapter 5Write a program that generates random numbers between 1 and 10 and fill an array ofsize 20 with them.Have your program sort the array then output in order the number ofoccurrences of each random number generated.Use the STL sort function to sort yourarray.How to use the STL sort:#include <algorithm>...int a[20]...sort(a,a+20);I recommend pseudo code to develop an algorithm before coding this.Example Output:This program generates random numbers and tabulates the resultsOriginal List Sorted:a[ 0]1a[ 1]1a[ 2]1a[ 3]2a[ 4]2a[ 5]3a[ 6]6a[ 7]6a[ 8]6a[ 9]7a[10]8a[11]8a[12]8a[13]9a[14]9a[15]9a[16]9a[17] 10a[18] 10a[19] 10N Count1:32:23:14:05:06:37:18:39:4
Attachments: