Witam. Może mi ktoś powiedzieć czemu mi ten warunek nie chodzi?
if (stos.size() <= 0)
cout << "error";
Jak coś zamieszczam też cały kod
#include <iostream>
#include <string>
#include <vector>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
using namespace std;
int c;
string x;
vector < int > stos;
do{
cin >> x;
if ((x=="push") || (x=="PUSH")){
cin >> c;
for( int i = 0; i < 1; i++ ){
stos.push_back( c );
}
}
if ((x=="pop") || (x=="POP")){
stos.pop_back( );
}
}while ((x!="end") && (x!="END"));
if (stos.size() <= 0)
cout << "error";
else{
for( int i = 0; i < stos.size(); i++ )
{
cout << stos[ i ];
}
}
return 0;
}