write a modular program to read four characters from the keyboard and determine the greatest character in terms of the ordering of the alphabets (a, b,..., x, y, z). The program should use a function called isGreatest called from within main() to perform the storing and return the result back. PLEASE HELP ME I WILL BE WRITING A BIG TEST TOMORROW
you can have functions read(), cmp() and write.Read function would read the input from standard input.Compare function would be an O(N) procedure which will find the greatest character.And write would be a function which is called after compare and just writes the greatest character.
You haven't specified the language but I'll assume a 'C'-like one anyway. Pseudo-code might look like: Get all four inputs Call isGreatest, sending it all four characters Return the greatest character The isGreatest function will need to compare each of the characters to determine which is the greater. Using a variable to hold the greatest of each comparison will probably help. This is the fun part of learning to code: coming up with the algorthm :)
Join our real-time social learning platform and learn together with your friends!