B.Tech. (I) - ICP-132 (2008) Assignment 1 Level 0 ------- 1. Read two strings and print the number of characters present in them. Eg Input: Helo 1233h3 Output: 4 6 2. Read three strings and print them in dictionary order Eg Input: efd x eda Output: eda efd x 3. Read three real numbers x, y and z and print the value of (x^2*y)/z. Input: 2.1 0.7 0.3 Output: 10.29 Level 1 ------- 1. Print the smallest and largest values that your compiler can support for int, short int, float, double and char. Print the precision of float and double. How is precision defined? (Hint: See https://iws60.iiita.ac.in/wiki/cpp/doku.php?id=dgg:ch_02:ranges ) 2. Read two numbers x and y and using only one "cout" print if they are even or odd. Eg Input: 2 3 Output: even odd 3. Read 3 integers and print the smallest of char, short int, int or long int that will be able to hold the values. The type could be unsigned if the number is non-negative. Give preference to signed over unsigned. Eg Input: 5 187 4294967295 Output: char short int unsigned int Level 2 ------- 1. Write a program to show 5 different ways to create a string. 2. Write a program that creates a string that is made of first 3 characters of two input strings. Eg: Input: 4562332423 ffdsfg Output: 456ffd 3. Two strings have values "32" and "123.21". Convert them into int and float and print the values when 10 is added to them (ie print numbers 42 and 133.21). Level 3 ------- 1. Write a C++ program that takes 3 integers as input and prints if they are divisible by 2, 3 or 6. If the number is divisible by more than one of the three it should print the greater of all. The number of digits could be 1000. Eg Input: 2 12345678901234567890123456789012345678901234567890 9 Output: 2 6 3 2. Given three string of 5 letters, print the number of distinct number of letters. Eg Input: abccb edasf aavav Output: 3 5 2 3. Print the gap number of letters between the letters X and Y in a given string. Input: abcXijklmYsada Output: 5