Task On String and Structure
Task On String and Structure
4. Take a string as input and find how many vowels appears in it.
Sample Input: I Like Programming.
Sample Output: vowels appeared 6 times.
6. Write a program that will create custom ciphers (encoded words) on strings. Follow
this procedure:
i. Write a function named encode that takes TWO parameters, a string s and an
integer j.
ii. Skip j number of characters in the string and increase the ASCII value of the next
character by 2.
iii. Perform step (ii) throughout the string.
iv. Return the converted string from encode function.
For example,
Sample String (s): I am a student
Sample Integer (j): 2
Converted String: I cm c svudgnt
7. Write a Structure named Student with the following attributes:
int id
string name
double cgpa
char gender
int creditCompleted
string department
bool checkProbation( ) // The structure also has the following method
that checks for students whose cgpa is less than 2.5.
Write a main function to create an array of 5 students and print the name of the
probation students from the array.