list-empty

////////////////////////////////////////
//      2018/04/25 21:22:00
//      list-empty

// true if the list is empty
#include <iostream>
#include <list>

using namespace std;

int main(){
    list<int> l;

    cout << "List is";
    l.empty() ? cout << " " : cout << "not";
    cout << "empty." << endl;

    l.push_back(100);

    cout << "List is";
    l.empty() ? cout << " " : cout << "not";
    cout << "empty." << endl;
    return 0;
}


/*
OUTPUT:
    List is empty.
    List isnotempty.
*/ 
posted @ 2018-04-25 22:03  老耗子  阅读(165)  评论(0编辑  收藏  举报