Advertisement
kirill_76rus

sttudent

Sep 11th, 2019
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include<iostream>
  2. #include<vector>
  3. #include<string>
  4. using namespace std;
  5. class student{
  6.     string first_name;
  7.     string second_name;
  8.     string group;
  9.     vector <int> ball;
  10. public:
  11.     bool average(){
  12.         int size=ball.size();
  13.         int sum=0;
  14.         for(auto s:ball){
  15.             sum+=s;
  16.         }
  17.         double aver=(sum/size);
  18.         if(aver>3){
  19.             return true;
  20.         }
  21.         return false;
  22.         }
  23.  
  24.     void date(string name,string surname, string group_1){
  25.         first_name=name;
  26.         second_name=surname;
  27.         group=group_1;
  28.     }
  29.     void ball_2(vector <int> size){
  30.         ball=size;
  31.     }
  32.     void no_name(vector <int> ball_1){
  33.         ball=ball_1;
  34.     }
  35.     void print(){
  36.         cout<<first_name<<' '<<second_name<<' '<<group<<endl;
  37.  
  38.     }
  39. };
  40. int main(){
  41.     student vasya;
  42.     vasya.date("vasya","pupkin","rt");
  43.     vector <int> nums_3={1,2,4,5};
  44.     vasya.ball_2(nums_3);
  45.     cout<<vasya.average()<<endl;
  46.     vasya.print();
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement