GarikK

Написать программу «успеваемость». Пользователь вводит 10 оц

Feb 27th, 2020
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. // arrays2homeWork.cpp
  2. //
  3.  
  4. #include <iostream>
  5. using namespace std;
  6. int main()
  7. {
  8.     const int assessments = 10;
  9.     int ar[assessments];
  10.     int replaceMark;
  11.     int sum = 0;
  12.     double average = 0;
  13.     cout << "Please enter the assessments of a student " << endl;//asking marks of a student
  14.     for (int i = 0; i < assessments; i++)
  15.     {
  16.         cin >> ar[i];//entering marks
  17.     }
  18.     cout << "Here are the assessments of the student: " << endl;
  19.     for (int i = 0; i < assessments; i++)
  20.     {
  21.         cout << ar[i] << endl;//showing the marks of a student
  22.     }
  23.     //retake the mark ( exam )
  24.     cout << "The retake an exam\n enter what mark you want to retake" << endl;
  25.     cin >> replaceMark;//asking what mark need to retake
  26.     cout << "Old mark is " << ar[replaceMark - 1] << endl;//showing old mark
  27.     cout << "Enter a new mark - ";
  28.     cin >> ar[replaceMark - 1];//entering a new mark
  29.     //calculate the scholarship
  30.     for (int i = 0; i < assessments; i++)
  31.     {
  32.         sum += ar[i];
  33.     }
  34.     average = sum / 10;
  35.     cout << "The average is " << average << endl;
  36.     if (average == 10.7 || average > 10.7)
  37.     cout << "You have the scholarship!" << endl;
  38.    
  39. }
Add Comment
Please, Sign In to add comment