-
The assignments for the file operation
-
Open and read a file of integers into an array that is created with the first integer telling you how many to read.
-
So 4 9 11 12 15 would mean create an int array size 4 and read in the remaining 4 values into data[].
-
Then compute their average as a double and their max as an int. Print all this out neatly to the screen and to an output file named answer-hw3.txt-hw3.
-
Solution for the program
-
main.c is the main file for the file operation as per suggested in the assignment. we have also created the file inputdata.txt as suggested in the statement
-
to run the main.c please use the below command in the Linux / DOS based system.
-
cd file_ops/
-
gcc main.c
-
./a.out
-
File open sucessfully
-
Element 0: 9
-
Element 1: 11
-
Element 2: 15
-
Element 3: 12
-
Average - 11.750000 and MAX - 15
-
also creates the answer-hw3.txt
-
To view the the file answer-hw3.txt .please use the below command
-
cat answer-hw3.txt
-
Notifications
You must be signed in to change notification settings - Fork 0
jishang1602/file_ops
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published