Professional Documents
Culture Documents
Department of Information Systems and Technologies Spring 2020 - 2021
Department of Information Systems and Technologies Spring 2020 - 2021
1. At the end of the semester in Studio course, each team will submit a project. Each project has team number, subject and
project details (video prepared (Y/N), poster grade and jury grade). The information for all projects is kept in the text file
named “projects.txt”.
Write a C program that reads the information into a dynamically created NESTED structure array and displays the detailed
project information including the overall grade for each team.
(Use dynamic memory allocation for the nested structure array. The first line of the file consists the number of projects)
If the team prepared a video for the project, 10 pts bonus will be given to the team.
5
1 climateChange Y 85.50 95
2 violenceAgainstwomen Y 90 100
3 animalRights N 80 82.5
4 pediatricDevelopment Y 90 97.5
5 climateChange N 82.50 95
Example Run:
Write a main program that reads and displays the team’s information. The program will also display the information of the
winner team.
Project Name: LG5_Q2
File Name: Q2.cpp
Example Run:
Team Name Pts Matches Wins Losses volleyball.txt
-------------------------------------------
sportoto 43 22 15 7 sportoto 43 22 15 7
arhavi 7 22 2 20 arhavi 7 22 2 20
ziraatbankasi 43 22 14 8 ziraatbankasi 43 22 14 8
halkbank 40 22 12 10 halkbank 40 22 12 10
tokat 16 22 6 16 tokat 16 22 6 16
bursa 34 22 12 10 bursa 34 22 12 10
arkasspor 50 22 16 6
arkasspor 50 22 16 6
fenerbahce 58 22 20 2
fenerbahce 58 22 20 2
galatasaray 44 22 15 7
istanbul 26 22 9 13 galatasaray 44 22 15 7
inegol 16 22 6 16 istanbul 26 22 9 13
sorgun 19 22 5 17 inegol 16 22 6 16
sorgun 19 22 5 17
The Winner team:
fenerbahce 58 22 20 2
3. A vending machine will be simulated; the product list of the machine is stored in the file named “products.txt” with the
name, unit price and quantity. The first line of the file consists of the number of products.
Initially the program reads all the products’ information from the file into a dynamically created structure array and displays
them on the screen. While reading the product name you should use %[^0-9].
Then the program gets the product number from the customer and if the product does not run out of in the machine,
customer inserts the money, otherwise gives an error message. After the purchase is finished, the remaining money should
be returned back to the customer. If the inserted money is not enough to purchase the product, program gives an error
message. When the product is run out of, the quantity of the item should be displayed OUT in the menu as in the example
run. When the user enters -1 for the product number, program terminates.
************************
Today 2 products sold
Total payment is: 2.45 TL
Additional Questions
AQ1.
The weekly temperature for 15 cities is kept in the weather.txt file.
Write a C program that reads the number of cities(n) from the user and reads the information for n cities from the text file
into the dynamically created two-dimensional array. The program displays the temperatures on the screen, then finds and
displays the coldest city with temperature and the day of the week like MONDAY, TUESDAY, ... (See the example run).
Example Run#2:
City M T W R F S S
---- --- --- --- --- --- --- ---
1 3 13 6 20 4 18 5
2 1 4 1 8 4 3 5
3 13 14 6 5 3 7 8
4 19 8 9 14 8 3 -3
5 8 2 4 6 -7 -1 0
6 9 10 5 -2 0 2 4
7 7 6 10 0 -1 4 -2
8 1 -5 -4 -3 -2 1 -4
9 19 15 10 9 4 2 0
10 20 19 16 12 11 14 16
11 13 10 14 13 4 -3 -4
12 6 -8 3 5 6 7 6
13 19 9 8 10 1 2 8
typedef struct{
int id;
grades_t gr;
double overall;
}applicantsOfII_t;
Write a C program that reads the entirety of applicants’ information from applicants.txt file into an array of structures, and
displays all the information on the screen as necessary, as shown in the example run below.
Project Name: LG5_AQ2
File Name: AQ2.cpp
applicants.txt
1111 49 65 94
2222 79 58 45
3333 76 88 95
Example Run :
Applicant ID: 1111
Scores:
Applicant English Proficiency: 49
Applicant Jury: 65
Applicant Graduate Examination: 94
Applicant Overall: 66.0
Scores:
Applicant English Proficiency: 79
Applicant Jury: 58
Applicant Graduate Examination: 45
Applicant Overall: 61.7
Scores:
Applicant English Proficiency: 76
Applicant Jury: 88
Applicant Graduate Examination: 95
Applicant Overall: 85.8
Average is 71.2
Number of the applicants who pass is 1
Number of the applicants who fail is 2