0% found this document useful (0 votes)
15 views

Task On String and Structure

The document describes 7 tasks related to strings and structures in programming: 1. Count the length of a input string 2. Reverse an input string 3. Merge two input strings together 4. Count the number of vowels in an input string 5. Compare two input strings 6. Create an encoding function that shifts characters in a string by a set interval 7. Define a Student structure with attributes like name and GPA, and check an array of students for probation status

Uploaded by

Shanto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Task On String and Structure

The document describes 7 tasks related to strings and structures in programming: 1. Count the length of a input string 2. Reverse an input string 3. Merge two input strings together 4. Count the number of vowels in an input string 5. Compare two input strings 6. Create an encoding function that shifts characters in a string by a set interval 7. Define a Student structure with attributes like name and GPA, and check an array of students for probation status

Uploaded by

Shanto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Task on Strings and Structure

1. Take a string as input and count its length.


Sample Input: I Like Programming.
Sample Output: Length of string is 19.

2. Take a string as input and reverse it.


Sample Input: I Like Programming.
Sample Output: .gnimmargorP ekiL I

3. Take two strings as input and merge them.


Sample Input1: I Like Programming.
Sample Input2: Let’s do some Practice.
Sample Output: I Like Programming. Let’s do some Practice.

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.

5. Take two strings as input and compare them.


Sample Input1: Hello World.
Sample Input2: Bye World.
Sample Output: Not Same.

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.

You might also like