Professional Documents
Culture Documents
( ) { ( ) ( ) ( )
1710 - FN
COMP6047 – Algorithm and Programming (4/2)
1710 - FN
COMP6047 – Algorithm and Programming (4/2)
Output
Sorted data and Modification status (all data has been sorted before -> no
modification, there are already sorted data in the right place -> small modification,
there are no sorted data -> big modification)
1st Sample Input
3
Alpha
Charlie
Beta
Output for 1st Sample Input
Alpha ; Beta ; Charlie
Small Modification
1710 - FN
COMP6047 – Algorithm and Programming (4/2)
6. Create a program to get 3 input as much as n input and 1 input as the sort criteria.
Input
The first input is n (1 ≤ n ≤ 5)
The second input is name (validate the length is between 5-25 characters).
The third input is code (validate the length must be 5 characters alphanumeric).
The fourth input is stock (validate the stock is between 0-15).
Store the second until fourth input in one struct.
The last input is string (validate the input is ascending/descending).
Output
If the last input is ascending, show the data sorted by name ascending, else if the last
input is descending, show the data sorted by stock descending.
1710 - FN
COMP6047 – Algorithm and Programming (4/2)
1710 - FN