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

Sturcture

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)
18 views

Sturcture

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/ 10

Structure related problems

(Total # questions)

No. Problem statement Difficulty


level

1 Declare a structure of students with three member variables (name, id and cgpa), where name is a *
string and id are strings, and cgpa is a float value.

2 Declare a structure of students with three member variables (name, id and cgpa), where name is a *
string and id are strings, and cgpa is a float value with default values.

3 Given a structure student, which has three member variables (name, id and cgpa), declare a variable *
of structure student.

4 Given a structure student, which has three member variables (name, id and cgpa), declare a variable *
of structure student. Display the value of the member variables.

5 Given a structure student, which has three member variables (name, id and cgpa), declare a variable *
of structure student. Assign values to the member variables.

6 Given a structure student, which has three member variables (name, id and cgpa), declare a variable *
of structure student. Populate the member variables from the keyboard.
7 Declare a structure of students with three variables (name, id and cgpa). Take information of two *
students as input and show the output.

Sample Input Sample Output

Shakib Al Hasan Shakib Al Hasan

101 101

3.5 3.5

Tamim Iqbal Tamim Iqbal

102 102

2.7 2.7

8 Declare a structure of students with three variables (name, id and cgpa). Now take the *
input of two students and print the information of that student who has the higher cgpa.

Sample Input Sample Output

Shakib Al Hasan Shakib Al Hasan

101 101

3.5 3.5

Tamim Iqbal

102

2.7
9 Declare a structure of students with three variables (name, id and cgpa). Now take the **
input of two students and print the information of that student who has better cgpa with
a function.

Sample Input Sample Output

Shakib Al Hasan Shakib Al Hasan

101 101

3.5 3.5

Tamim Iqbal

102

2.7

10 You have to declare a structure named triangle. triangle_id, base and height are the *
members of this structure. Now you will have to take input of three triangles and find out
the area of each triangle.

[Triangle Area = (base*height)/2]

Sample Input Sample Output


1 Area of 1 = 20

5 Area of 2 = 12

8 Area of 3 = 6

4
11 You have to declare a structure named triangle. triangle_id, base and height are the **
members of this structure. Now you will have to take input of three triangles and find out
which triangle has the maximum area using a function.

[Triangle Area = (base*height)/2]

Sample Input Sample Output

1 Area of 1 = 20

4
12 The Tigers have clinched a stunning victory over their rivals recently. In that series of three **
matches, some players put up some amazing performances. Now you have to create a
structure named player where you have to store the following information of each player:

1. Player’s name

2. Player’s country

3. Array(size 3) to store runs of 3 matches

4. Array(size 3) to store wickets of 3 matches

5. Array(size 3) to store points of 3 matches

Count points using the following formula:

1. Each wicket = 12 points

2. Runs <=25 in a match = 5 points

3. 25< Runs<=50 in a match = 10 points

4. 50< Runs<=75 in a match = 15 points

5. 75< Runs in a match = 20 points

Now, take input of two players and calculate the points for each player for all the three
matches.

Sample Input Sample Output


Shakib Al Hasan Match 1:

Shakib Al Hasan points: 17


Bangladesh
Tamim Iqbal points: 20
20

75 Match 2:

Shakib Al Hasan points: 27


103
Tamim Iqbal points: 20
1

1 Match 3:

5 Shakib Al Hasan points: 80

Tamim Iqbal points: 5

Tamim Iqbal

Bangladesh

100

109

17

0
13 The Tigers have clinched a stunning victory over their rivals recently. In that series of three ***
matches, some players put up some amazing performances. Now you have to create a
structure named player where you have to store the following information of each player:

1. Player’s name

2. Player’s country

3. Array(size 3) to store runs of 3 matches

4. Array(size 3) to store wickets of 3 matches

5. Array(size 3) to store points of 3 matches

Count points using the following formula:

1. Each wicket = 12 points

2. Runs <=25 in a match = 5 points

3. 25< Runs<=50 in a match = 10 points

4. 50< Runs<=75 in a match = 15 points

5. 75< Runs in a match = 20 points

Now, take input of two players and calculate the points for each player for all the three
matches. And also find man of the match(MOM) for each match based on their points and
find out the man of the series on more points overall.

Sample Input Sample Output


Shakib Al Hasan Match 1:

Shakib Al Hasan points: 17


Bangladesh
Tamim Iqbal points: 20
20 MOM : Tamim Iqbal

75 Match 2:

Shakib Al Hasan points: 27


103
Tamim Iqbal points: 20
1
MOM : Shakib Al Hasan
1

5 Match 3:

Shakib Al Hasan points: 80

Tamim Iqbal points: 5


Tamim Iqbal MOM : Shakib Al Hasan

Bangladesh
Man of the Series: Shakib Al Hasan
100

109

17

0
Today 8th class: Online 3 ; Structure
9th class: Mid viva(Loop,Array,String); recursion
10th class: Online 4 & online 5(Function and recursion);
11th class: Recursion and Pointers
12th class: Online 6 and Final Viva

You might also like