Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need Program in C langauge and with correct output please include screenshots of out put Our institute decided to split the students into four groups

Need Program in C langauge and with correct output please include screenshots of out put

Our institute decided to split the students into four groups to conduct an event. The procedure for splitting is as follows: h(A) = (Sum of ASCII value of the characters in the first name of A + age of A) % 4, where A represents a student.

Eg:- h(Veena) = (86+101+101+110+97+19) % 4 = 2; where, 86 - ASCII(V), 101 - ASCII(e), 110 - ASCII(n), 97 - ASCII(a), 19 - age(Veena). If h(A) =0, the student is placed in group 0; if h(A) = 1, the student is placed in group 1; if h(A) = 2, the student is placed in group 2, and if h(A) = 3, the student is placed in group 3.

Write a program to perform the operations count the number of students in each group, the student list in a group as per the order of insertion, and the student list who belongs to the same branch in a group.

Note: Assume all the students are from CS, EC, EE, or CE branches. Input format: First line of the input contains an integer n [1, 103 ], the total number of students who are participating in the event.

Next n consecutive line contains: first name, roll number, and age; separated by single space. The input contains a character c followed by an integer k [0, 3] to display the count and student list of the group k.

The input contains an integer m [0, 3], representing the group number, followed by two characters representing the branch name (both uppercase and lowercase are considered the same branch).

The input contains a character e to represent the end of the input. Output format:

The output (if any) of each command should be printed on a separate line.

For input lines starting with the character c followed by an integer k [0, 3], prints an integer x followed by x number of strings separated by a space.

For input lines starting with an integer m [0, 3] followed by two characters, prints the strings (first name) separated by a space, if any student exit in the group m. Otherwise, print -1.

Sample Input:

4

Veena B220016EC 19

Abu B210051CS 21

Ishan B190016CE 22

Aleena B200036EE 21

c 0

1 CS

c 1

c 2

c 3

3 EC

2 ec

e

Sample Output:

0

Abu

2 Abu Ishan

1 Veena

1 Aleena

-1

Veena

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions