Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- vector<int> setMarks(int count) {
- int mark = 0;
- vector<int> arr(count);
- for(int i = 0; i < count; i++){
- cout << "Введите отметку\n";
- cin >> mark;
- if(mark < 1 || mark > 10) {
- cout << "Отметки должны быть от 1 до 10 баллов\n";
- i--;
- } else
- arr[i] = mark;
- }
- return arr;
- }
- bool lessThan(vector<int> arr, int num) {
- bool res = false;
- for(int i = 0; i < arr.size(); i++){
- if(arr[i] < num)
- res = true;
- }
- return res;
- }
- int main() {
- cout << "Данная программа проверяет студента на успеваемость на основании его отметок\n" << endl;
- int marksCount = 0;
- cout << "Введите количество отметок \n";
- cin >> marksCount;
- vector<int> marks = setMarks(marksCount);
- bool badStudent = lessThan(marks, 4);
- if(badStudent)
- cout << "Студент является неуспевающим";
- else
- cout << "Студент является успевающим";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement