Assessment Arrays Medium

From Progzoo
Jump to: navigation, search

TicTacToe

Read a three by three lines of noughts and crosses ("O" and "X"). Print "true" if the crosses side has won the game; print false otherwise.

The test files used are:

XXX
OOX
XOO
XOX
OOX
XOO
X X
OOX
OOX
O X
OOX
XXO



[Font] [Default] [Show] [Resize] [History] [Profile]

Magic Square

Read in four lines of four numbers separated by the tab character.

Print "true" if these form a “magic square”; print "false" otherwise. A magic square is one where all the number in each row, column and the diagonals add up to the same number:

The test files used are:

16	2	3	13
9	6	7	12
5	11	10	8
4	14	15	1
16	2	3	13
9	7	6	12
5	11	10	8
4	14	15	1



[Font] [Default] [Show] [Resize] [History] [Profile]

Perfect Module

Read in a list of marks from a file, each between 0 and 100. Print "true" if this represents the perfect module mark sheet and false otherwise. To be perfect a module must have a mean between 55 and 60 and a standard deviation between 5 and 15. No more than 10% may fail (less than 40) and no more than 20% may have merit (more than 64).