Page 389 - Computer science 868 Class 12
P. 389

void recletters()                :    finds the total number of capital and small letters using recursive function
                        void display()                   :    prints cap and small
                        Specify the class Check giving details of the constructor and void recletters() and void display(). The main() function need not be
                       written.
                    8.  Write a program to input a sentence and print only those letters that are consecutives.
                        Sample Input : UNDERSTANDING SCIENCE
                        Sample Output:
                        DE, RS, ST
                    9.  The input in this question will consist of a number of lines of English text consisting of the letters of the English alphabet, the
                       punctuation marks like apostrophe ('),  full stop (.), comma (,), semicolon (;), colon (:) and white space characters (blank, new
                       line). Your task is to write a program to print the words of the text in reverse order without any punctuation marks other than
                       blanks.
                        Sample Input:
                        This is a sample piece of text to illustrate this question.
                        If you are smart you will solve this right.
                        Sample Output:
                        right this solve will you smart are you if question this illustrate to text of piece sample a is this
                        Note: Individual words are not reversed.
                        Input Format:
                        This first line of input contains a single integer n ( < = 20), indicating the number of lines in the input.
                        This is followed by the lines of input text. Each line should accept a maximum of 80 characters.
                        Output Format:
                        Output the text in lowercase containing the input lines in reverse order without punctuations except blanks as illustrated above.
                    10.  Read a single sentence which terminates with a full stop (.). The words are to be separated with a single blank space and are in
                       lowercase. Arrange the words contained in the sentence according to the length of the words in ascending order. If two words are
                       of the same length, then the word occurring first in the input sentence should come first. For both input and output, the sentence
                       must begin with an uppercase letter.
                        Test your program for given data and also some random data.
                        Input:
                        The lines are printed in reverse order.
                        Output:
                        In the are lines order printed reverse.
                        Input:
                        Print the sentence in ascending order.
                        Output:
                        In the print order sentence ascending.
                        Input:
                        I love my Country.
                        Output:
                        I my love Country.
                    11.  Write a program to accept a sentence, which includes some special characters like punctuation marks and display the sentence
                       in reverse order by removing the punctuation marks.
                   12.   Write a program to find the frequency of one string in another string with the following specifications.
                        class                            :    frequency
                        Data Members
                        String mstr                      :  stores the original string
                        String subs                      :  stores the string to be counted
                        Member Methods
                        void input()                     :  enter a string
                        void find()                      :  find the frequency of subs in mstr




                                                                                                                       387
                                                                                                              Strings  387
   384   385   386   387   388   389   390   391   392   393   394