Problem 1: Reverse :
Write a procedure reverse (S : in out STRING) that reverses the string S.
Example of execution:
******************************************
********* String reverse *****************
******************************************
Enter a string : tide
The reverse string of tide is : edit
Problem 2: Concatenation :
Write a function cattac that takes as argument a string S then return
the concatenation of S and its reverse string.
Function cattac (S : STRING) return STRING is...
Example of execution:
******************************************
********* Concatenation ******************
******************************************
Enter a string : palindrome
The concatenation of palindrome and its reverse gives : palindromeemordnilap
Problem 3 (Optional) : Palindrome : A palindrome is a string reading the same forward
and backward.
Examples of palindromes are : ada radar madam cattac palindromeemordnilap.
You are to write a function
Function is_palindrome (S : STRING) return BOOLEAN is...
As a comment, explain why is_palidrome(cattac(S)) return always TRUE. (S in a given string).
Problem 4: Capital Letters :
In some problems, it is necessary to normalize some text so that all the letters within it
are capitalized.
You are to write a procedure to_upper (S : in out STRING) that
capitalizes all small letters in S. The procedure should have no effect on capital letters or
non-letters characters.
Example of execution:
******************************************
********* Capitalizing *******************
******************************************
Enter a string : Do you know a one-to-one mapping between N and N x N? Think Cantor!
The capitilized STRING is :
DO YOU KNOW A ONE-TO-ONE MAPPING BETWEEN N AND N X N? THINK CANTOR!
Note : Use of attributes POS and VAL is highly recommended.
Problem 5: Ada Identifier :
You are to write a function is_identifier that takes as argument a string ID and return TRUE is
the string a valid Ada identifer and FALSE otherwise.
Function is_identifier (ID : STRING) return BOOLEAN is...
Example of execution:
******************************************
********* Ada Identifiers*****************
******************************************
Enter an Identifier : Ada95 --> valid Ada identfier
Enter an Identifier : Ada95_beta_version --> valid Ada identifer
Enter an Identifier : __valid_C_identifier --> non valid Ada identifier