Answer the following questions 1. Write a program to do the following: a. To output the question "Who is the inventor of C++ ?" b. To accept an answer c. To print out "Good" and then stop, if the answer is correct. d. To output the message "try again", if the answer is wrong. e. To display the correct answer, when the answer is wrong even at the third attempt and stop. 2. Write a program to extract a portion of a character string and print the extracted string. Assume that m characters are extracted and starting with the nth character. 3. Write a program, which will read a text and count all the occurrences of a particular word. 4. Write a program, which will read a string and rewrite it in the alphabetical order. For example, the word STRING should be written as GINRST. 5. Write a program to read from a text file, and display it along with the line numbers prefixed to it. 6. Write a program to write records of students consisting of roll number, name, marks and class into a file. Then access the record of any particular student from the file. 7. Write a program to merge two text files to create a new file. 8. Write a program to compare two file and display the message if the two file are exactly similar otherwise display the line number, where the first mismatch occurs. |
Course Content > Session 6 >