#include<iostream>
#include<string>
#include <sstream>
using std::cout;
using std::cin;
using std::endl;
using std::string;
using std::stringstream;
class questions {
private:
string name;
string lastname;
int rate_list[50];
int rate_count;
float middle;
public:
void read_name(){
cout << "Your name" << endl;
cin >> name;
}
string get_name(){
return (name);
}
void read_lastname(){
cout << "Your lastname" << endl;
cin >> lastname;
cin.ignore ();
}
string get_lastname(){
return (lastname);
}
float get_middle(){
return(middle);
}
void read_rate_list(){
rate_count = 0;
//rate_count ++;
string rate_line, rate_word;
int summa = 0;
int value = 0;
cout << "Enter your grades (separate by space)" << endl;
cin.clear();
getline(cin, rate_line);
stringstream potok(rate_line);
while (potok >> rate_word) {
if (rate_word == "1" || rate_word == "2" || rate_word == "3" || rate_word == "4" || rate_word == "5") {
//cout << rate_word;
value = stoi(rate_word);
// cout << value << endl;
rate_list[rate_count] = value;
summa += value;
rate_count++;
}
}
middle = summa / rate_count;
}
int* get_rate_list() {
return(rate_list);
}
};
int main(){
questions persone1;
persone1.read_name();
persone1.read_lastname();
persone1.read_rate_list();
cout << persone1.get_name() << endl;
cout << persone1.get_lastname() << endl;
cout << persone1.get_middle() << endl;
// cout << persone1
} Выводит целое число, а надо вещественное. Заранее спасибо