The problem is that after entering the correct value (figures), it is not proposed to enter another value - size2. How to fix?
#include "stdafx.h" #include <iostream> #include <conio.h> #include "MyClass.h" using namespace std; int main() { MyClass a,b; int size1, size2; cout<<"Enter first size : "; while (!(cin >> size1) || (cin.peek() != '\n')) { cin.clear(); while (cin.get() != '\n'); cout << "nepravilno"; } cin>>size1; cout<<endl<<"Enter second size : "; cin>>size2; cout<<endl; a.set_mass(size1); b.set_mass(size2); a.show_mass(); cout<<endl; b.show_mass(); cout<<endl<<" intersection rezult : "<<endl; a.intersection(b); getch(); return 0; }