HW1Algorithm.txt
971 Bytes
Algorithm:
Define Structures:
Define the Student structure with attributes: student_code, name, and id_code.
Define the Resident structure with attributes: id_code and city.
Read Data from Files:
Read data from F1.txt and store it in an array of Student structures.
Read data from F2.txt and store it in an array of Resident structures.
User Input:
Prompt the user to input a string Residence.
Match Students:
Iterate through the list of students and residents.
For each student, check if their id_code matches the id_code of any resident with the given Residence.
If a match is found, add the student to the list of matching students.
Output Results:
Check if there are any matching students.
If there are matching students, print their details (Student Code, Name, ID Code).
If no matching students are found, print a message indicating that no students were found with the given residence.
Program Termination:
After printing the results, terminate the program.