Czesć Mam prosbe dlaczego podczas ponownej probie podania imienia inaziwska nie moge tego zrobic
#include <iostream>
using namespace std;
const int SLEN = 30;
struct student {
string fullname;
string hobby;
int ooplevel;
};
int getinfo(student pa[], int n) {
for(int i=0; i<n; i++) {
cout << "Podaj imie i naziwsko studenta: ";
getline(cin, pa[i].fullname);
cout << "Podaj hobby studenta: ";
getline(cin, pa[i].hobby);
cout << "Podaj level studenta: ";
cin>>pa[i].ooplevel;
if(pa[i].fullname == "") {
return i;
break;
}
}
}
void display1(student st) {
cout << "Nazwisko: "<<st.fullname<<endl;
cout << "Hobby: "<<st.hobby<<endl;
cout << "Level: "<<st.ooplevel<<endl;
}
void display2(const student *ps) {
cout << "Nazwisko: "<<ps->fullname<<endl;
cout << "Hobby: "<<ps->hobby<<endl;
cout << "Level: "<<ps->ooplevel<<endl;
}
void display3(const student pa[], int n) {
for(int i=0; i<n; i++) {
cout << "Nazwisko: "<<pa[i].fullname<<endl;
cout << "Hobby: "<<pa[i].hobby<<endl;
cout << "Level: "<<pa[i].ooplevel<<endl;
}
}
int main()
{
int class_size;
cout << "Podaj wielkosc grupy: ";
cin>>class_size;
while(cin.get() != '\n') continue;
student * ptr_stu = new student [class_size];
int entered = getinfo(ptr_stu, class_size);
for(int i=0; i<entered; i++) {
display1(ptr_stu[i]);
display2(&ptr_stu[i]);
}
display3(ptr_stu, entered);
return 0;
}