Skip to content

Instantly share code, notes, and snippets.

@satojkovic
Created July 10, 2013 05:59
Show Gist options
  • Save satojkovic/5963777 to your computer and use it in GitHub Desktop.
Save satojkovic/5963777 to your computer and use it in GitHub Desktop.
#include <vector>
#include <iostream>
#include <string>
using namespace std;
void Empty(string str, vector<int> v)
{
if( v.empty() ) {
cout << str << " is empty" << endl;
}
else {
cout << str << " is not empty" << endl;
}
}
void Show(vector<int> v)
{
for(unsigned int i=0; i<v.size(); i++) {
cout << "(" << i << "): " << v[i] << endl;
}
}
int main()
{
vector<int> v1;
vector<int> v2;
v2.push_back(0);
v2.push_back(0);
v2.push_back(0);
Empty("v1", v1); Show(v1);
Empty("v2", v2); Show(v2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment