[SOLVED] IT1010 Tutorial 12

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Tutorial-12-p0hzec.zip (566.8 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (2 votes)

Question 1

  1. a)  Create a file called “number.dat” using the vi editor.
  2. b)  Type set of numbers and save those in the file.

a. e.g : 21 43 76 98 40

c) Using a C program enter another number from the key board and store it in the if the file does not already have that number. If the number exist in the file, display an error message.

d) Read the number.dat file and display all the numbers stored in the file. Question 2

A medical center wants to store the appointment details of their patients in a text file called “appointment.dat”. The patient details consist of patient name and the type of appointment. Type of appointment can be either “Consulting”, “Scanning” or “Testing”. Only the first letter of the appointment type will be stored in the file.

Write a C program to do the following.

  1. a)  Create a file called “appointment.dat”.
  2. b)  Enter data of 5 patients from the keyboard and write those data to the text file(sample input is given below).

    Dilshan C Ruwan T Mangala S Ganesh C Jithen S

  3. c)  Read the appointment.dat file and calculate and display the number of patients of each type as given below.

Appointment Type

Consulting Scanning Testing

Number of Patients

2 2 1

1

  • Tutorial-12-p0hzec.zip