# CSE102 – Computer Programming Homework #9 solved

\$35.00

## Description

5/5 - (1 vote)

In this homework, you must create a music stack list which has The Turkish Five. The Turkish Five is a
name used to identify five pioneers of western classical music in Turkey. The Turkish Five composers are
listed below in the table.
Name (char []) Surname (char [] Musical_Work(char []) age (int)
Cemal Reşit Rey Lüküs Hayat 80
Ahmed Adnan Saygun Yunus Emre 83
Ulvi Cemal Erkin Keloğlan 66
Hasan Ferit Alnar Sarı Zeybek 72
Necil Kazım Akses İkinci Senfoni 90
Create a stack that is implemented with a linked list. You must define struct person like;
struct person{
name (char[]);
surname (char[]);
musical_Work(char[]);
age(int);
struct person *next;
} *top;
In your program, you have to create a menu which has the following operations.
1- Add a Person to the Stack
Take person’s information with scanf, create a node and add the node to the stack using the function
addNode(char name[], char surname [], char creation [], int age).
CSE102 – Homework #9
Page 2 of 5
2- Pop a Person from the Stack
Delete the last node of the stack. Create deleteNode(…) to pop a node.
3- Sort in Alphabetical Order
Write a method Sort_Alphabetically(…) to order the names of the people in the stack alphabetically.
Use the print_stack(…) method to show the sorted stack.
4- Sort Age in Increasing Order
Write a method Sort_Increasingly(…) that sorts ages of people in the stack in increasing order. Use
the print_stack(…) method to show the sorted stack.
Example Output; (User entered values are written in bold.)
1- Add a Person to the Stack
2- Pop a Person from the Stack
3- Sort Alphabetical Order
4- Sort Age in Increasing Order
*************
Name: Cemal Reşit
Surname: Rey
Creation: Lukus Hayat
Age: 80
——————–
1)Cemal Reşit
Rey
Lukus Hayat
80
1- Add a Person to the Stack
2- Pop a Person from the Stack
3- Sort in Alphabetical Order
4- Sort Age in Increasing Order
*************
Surname: Saygun
Creation: Yunus Emre
Age: 83
——————–
Saygun
CSE102 – Homework #9
Page 3 of 5
Yunus Emre
83
2)Cemal Reşit
Rey
Lukus Hayat
80
1- Add a Person to the Stack
2- Pop a Person from the Stack
3- Sort in Alphabetical Order
4- Sort Age in Increasing Order
*************
Name: Ulvi Cemal
Surname: Erkin
Creation: Keloğlan
Age: 66
—————–
1) Ulvi Cemal
Erkin
Keloğlan
66
Saygun
Yunus Emre
83
3)Cemal Reşit
Rey
Lukus Hayat
80
1- Add a Person to the Stack
2- Pop a Person from the Stack
3- Sort in Alphabetical Order
4- Sort Age in Increasing Order
*************
Name: Hasan Ferit
Surname: Alnar
Creation: Sarı Zeybek
Age: 72
——
1) Hasan Ferit
Alnar
Sarı Zeybek
72
2) Ulvi Cemal
Erkin
Keloğlan
66
Saygun
Yunus Emre
83
4)Cemal Reşit
CSE102 – Homework #9
Page 4 of 5
Rey
Lukus Hayat
80
1- Add a Person to the Stack
2- Pop a Person from the Stack
3- Sort in Alphabetical Order
4- Sort Age in Increasing Order
*************
1) Ulvi Cemal
Erkin
Keloğlan
66
Saygun
Yunus Emre
83
3)Cemal Reşit
Rey
Lukus Hayat
80
1- Add a Person to the Stack
2- Pop a Person from the Stack
3- Sort in Alphabetical Order
4- Sort Age in Increasing Order
*************
Saygun
Yunus Emre
83
Cemal Reşit
Rey
Lukus Hayat
80
Ulvi Cemal
Erkin
Keloğlan
66
1- Add a Person to the Stack
2- Pop a Person from the Stack
3- Sort in Alphabetical Order
4- Sort Age in Increasing Order
*************
Ulvi Cemal
Erkin
Keloğlan
66
CSE102 – Homework #9
Page 5 of 5
Cemal Reşit
Rey
Lukus Hayat
80
Saygun
Yunus Emre
83
General Rules:
1. Unless otherwise noted, the given function prototypes should not be modified. If you do so, you will get zero
credit for that part of the assignment.
2. Note that if any part of your program is not working as expected, then you can get zero credit for the related
part, even it partially works for some cases.