Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

CS1001A

Programming in C Lab 13 : Strings

Problem 1: Write a program that takes Date from user as a string in the following format: dd/mm/yyyy. Now perform string tokenization operation on this string to separate the Day, Month and year. Your task is to print whether the date is valid or not Example: Valid Date: 02/03/1987 Invalid Date: 44/13/1987 Day should be in between 1 and 30. Month should be in between 1 and 12. Year should not be greater than 2012.

Problem 2: Declare a 1D string initialize it with consecutive alphabets. Now take a user input for the number of right shifts. Now your task is to rotate the 1D array rightwards according to the value entered by user. Display both the original and the rotated 1D string. For example if the array is a b c d e f g h i Your output should be:
How many times do you want to rotate: 3 (Entered by user) Original string is: abcdefghi Rotated string is: ghiabcdef

Problem 3: You know what a palindrome number is. The same concept can be used for strings. Basically, palindrome string is a string that is same if you read it forwards or backwards. Some palindrome strings examples are "dad", "radar", "madam" etc. You will have to write a program, that tells us whether the input string is palindrome or not. Hint: Reverse the original string and compare the resultant with the original. Note: Write your own string comparison function. Problem 4: Take Home

CASE Institute

Page 1 of 2

CS1001A

Programming in C Lab 13 : Strings

Study and implement strcmpi().

CASE Institute

Page 2 of 2

You might also like