Witam!
Mam problem przy klasach wyrzuca mi błąd w 11 linijce:|warning: no return statement in function returning non-void [-Wreturn-type]|. Nie wiem jak zwrócić. Proszę o wyrozumiałość jestem totalnie zielony w C++.
#include <iostream>
using namespace std;
template <typename Type, int rozmiar = 10>
class Stos
{
Type rep[rozmiar];
int top;
public:
Stack() {top = 0;};
bool isempty() {return top == 0;}
bool isfull() {return top == rozmiar;}
bool push(const Type & item)
{
if (top < rozmiar)
{
rep[top++] = item;
return true;
}
else return false;
}
bool pop(Type & item)
{
if (top >0)
{
item = rep[--top];
return true;
}
else return false;
}
};
int main()
{
//int k;
//Stos<int, 10> s, t;
//s.push(1); s.push(2); s.push(5);
//t = s; t.pop(k); cout<<k<<endl;
//t.push(7);
//s = t; s.pop(k); cout<<k<<endl;
int k;
Stos<int, 5> s, t;
for (int i=0; i<5; i++) s.push(i);
t = s; t.push(5); s.pop(k);
cout<<k<<endl;
return 0;
}