Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // arrays2homeWork.cpp
- //
- #include <iostream>
- using namespace std;
- int main()
- {
- const int assessments = 10;
- int ar[assessments];
- int replaceMark;
- int sum = 0;
- double average = 0;
- cout << "Please enter the assessments of a student " << endl;//asking marks of a student
- for (int i = 0; i < assessments; i++)
- {
- cin >> ar[i];//entering marks
- }
- cout << "Here are the assessments of the student: " << endl;
- for (int i = 0; i < assessments; i++)
- {
- cout << ar[i] << endl;//showing the marks of a student
- }
- //retake the mark ( exam )
- cout << "The retake an exam\n enter what mark you want to retake" << endl;
- cin >> replaceMark;//asking what mark need to retake
- cout << "Old mark is " << ar[replaceMark - 1] << endl;//showing old mark
- cout << "Enter a new mark - ";
- cin >> ar[replaceMark - 1];//entering a new mark
- //calculate the scholarship
- for (int i = 0; i < assessments; i++)
- {
- sum += ar[i];
- }
- average = sum / 10;
- cout << "The average is " << average << endl;
- if (average == 10.7 || average > 10.7)
- cout << "You have the scholarship!" << endl;
- }
Add Comment
Please, Sign In to add comment