CODING_THEORY_PRACTICE[1]

CODING_THEORY_PRACTICE[1] - CODING THEORY PRACTICE ...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CODING THEORY PRACTICE Create a program that reads the 10 first one ­digit numbers stored in a file (call it “input.txt”) and counts how many times each number (remember they are from 0 ­9 since they are all one ­digit) appears. The results should appear on screen. SAMPLE RUN File: Input.txt 1 3 2 2 2 5 8 6 0 9 7 6 4 OUTPUT: Appearances of 0: 1 Appearances of 1: 1 Appearances of 2: 3 Appearances of 3: 1 Appearances of 4: 0 Appearances of 5: 1 Appearances of 6: 1 Appearances of 7: 0 Appearances of 8: 1 Appearances of 9: 1 CODING THEORY PRACTICE Given an array int grades[150] of grades between 0 ­100 of an exam, print in a file “report.txt” the average of the class, the number of students that failed (failure limit is less than 60) and the value that appears the most in the exam. Example: Let us suppose that there are only 10 students in the exam (even though we want to do the program for the general case of 150 students) and their results are the following: int grades[10]= {70, 90, 100, 100, 90, 50, 60, 80, 90, 90}; Then in the file we should have: The mean is: 82. The number of students that failed is: 1. The value that appears the most: 90. ...
View Full Document

Ask a homework question - tutors are online