Program details
We are writing a Linux utility program.
We want to know how many users are logged in once, twice, 3-times, 4-times, etc.
Use the Linux w utility to create a file, then scrape the file.
sample output...
$ ./uvlab8
Odin current login statistics
-----------------------------
1 login: 12 users
2 logins: 5 users
3 logins: 1 user
5 logins: 1 user
One strategy to try:
Put the file records into an array.
Sort the array.
Read through the sorted array.
Count how many reads until the username is different.
That is a user logged in 'count' times.
Use 'count' as an index into a hash table.
Increment the hash table at that index.
Continue through the sorted array.
Display the output.
Using the strategy above...
1 2 3 5 are indexes of a hash table
12 5 1 1 are the values stored at those array indexes.
Rules...
Do not use the STL, vectors, <algorithm>, etc.
If you find any code online...
1. Put the URL in a comment.
2. Briefly explain why you could not write the code yourself.
Program files to be collected...
3350/8/uvlab8.cpp
3350/8/Makefile