Solution of #1: #include #include #include #include using namespace std; int main() { int n, i; ofstream outFile; string fileName; cout << "Enter a positive intger: "; cin >> n; cout << "Enter file's name: "; cin >> fileName; outFile.open(fileName.c_str()); srand(time(0)); for (i = 1; i <= n; i++) { outFile << rand() % 101 << endl; } outFile.close(); return 0; } Solution of #2: #include #include #include using namespace std; int main() { int n, i = 0, grade, count = 0, a[100]; ifstream inFile; string fileName; cout << "Enter file's name: "; cin >> fileName; inFile.open(fileName.c_str()); if (!inFile) { cout << Cant opne file:\n; return 1; } inFile >> grade; while(inFile && i < 100) { a[i] = grade; if (grade == 87) count++; i++; inFile >> grade; } inFile.close(); n = i; for (i = 0; i < n; i++) cout << a[i] << \t; cout << endl; return 0; } Solution of #3: #include #include #include using namespace std; int main() { int i, n, a[100], max, sum = 0; cout << "Enter the actual size of the array: "; cin >> n; if (n > 0) { for (i = 0; i < n; i++) { cout << "Enter an integral grade: "; cin >> a[i]; } max = a[0]; sum = a[0]; for (i = 1; i < n; i++) { sum += a[i]; if (a[i] > max) max = a[i]; } cout << "\n\tThe average is: " << sum / float(n) << endl; cout << "\tThe maximum is: " << max << endl << endl; } else cout << "You have to eneter a positive integr.\n"; return 0; }