hi
can anyone solve these 2 questions?
using loops and if statements
Exercise 2:
Write a C++ program to performing the following:
• Read a positive integer n from an input file called number.txt. Assume n is always an even number.
• Read n positive integers from the input file number.txt.
• Find the maximum of the first half of integers and the minimum of the last half of integers.
• Find the sum of all even numbers and the average of all odd numbers.
• All output should be directed to the screen monitor.
Sample input file: number.txt
10
23 12 45 13 67 18 14 98 89 35
Sample output
The maximum of the first half is: 67
The minimum of the second half is: 14
The sum of all even numbers is: 142
The average of all odd numbers is: 45.33
Exercise#3:
Write a program that finds students who score the highest and lowest average marks of the first two homework in CS (I). Your program should read the data from a file called "hw.txt" and displays the output to another file called “results.txt”. The first line of the input file contains the number of students, n. The next n lines contain information about each student. Each data line contains the student name (first name and last name) and his/her marks, each out of 30.
The output should display all student names, marks, and grades. In addition your program should calculate and display the highest and lowest marks along with the name of the student. Also, your program should calculate and display all the average and the grade of the entire class. (See sample input/output). Also, see table for assigning letter grades.
Why don't you give it a shot yourself, then post your code with whatever problems you run into. People are much more willing to help out someone who has made an attempt than someone who just posts with their hands out, asking for code.