Computer Science: Assignment 2 PDF

Title Computer Science: Assignment 2
Author Dani the Bear
Course Introduction to Information Technology (Advanced Program)
Institution Trường Đại học Bách khoa Hà Nội
Pages 2
File Size 62.2 KB
File Type PDF
Total Downloads 93
Total Views 155

Summary

Computer Science: Assignment 2...


Description

Assignment 2: String

Exercise 1: Write a program in C to count the total number of words in an inputed string. Example: - Input: Dai hoc Bach khoa HN - Output: The inputted string consists of 5 words Exercise 2: Write a program in C to find maximum occurring character in a string Example: - Input: Dai hoc Bach khoa HN - Output: Character ‘h’ is the highest frequency; it appears 4 times Exercise 3: Write a program in C to read 4 strings through keyboard and sorts them using bubble sort. Example: - Input: String 1: Dai String 2: Hoc String 3: Bach String 4: Khoa - Output: Bach Dai Hoc Khoa Exercise 4: Write a C program to ask user to input 2 string str1 and str2, then check whether str2 is a substring of str1 Example: - Input: String 1: Dai hoc Bach khoa String 2: hoc String 3: Hanoi - Output: String “hoc” is a substring of string “Dai hoc Bach Khoa” String “Hanoi” is not a substring of string “Dai hoc Bach Khoa”

Exercise 5: Write a program in C to ask user to input a word wd and a sentence st and then find the number of times a word wd appears in the sentence st Example: - Input: Word: hoc Sentence: Dai hoc Bach khoa HN dang to chuc day hoc theo mo hinh hoc tap blended learning - Output: The word “hoc” appears 3 times in the sentence “Dai hoc Bach khoa HN dang to chuc day hoc theo mo hinh hoc tap blended learning”...


Similar Free PDFs