#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <cstdlib>
using namespace std;
int main() {
int a=2 + 3.14, b=3 + 3.3;
cout << "a, b =" << (true ? 1, 2 : (3, 4) ) << endl;
int x[10];
int *p = x;
cout << "sizeof(x)/sizeof(*x): " << sizeof(x)/sizeof(*x) << endl;
cout << "sizeof(p)/sizeof(*p): " << sizeof(p)/sizeof(*p) << endl;
cout << "sizeof(p): " << sizeof(p) << ", sizeof(*p): " << sizeof(*p) << ", sizeof(int): " << sizeof(int)<< endl;
string str="hello world", str2;
vector<string> book = {"good", "morning", "hello"};
vector<string> book2;
cout << "sizeof str: " << sizeof(str) << "," << sizeof str2
<< " sizeof vector: " << sizeof(book) << "," <<sizeof(vector<int>) << endl;
for(auto vstr : book){
cout << vstr << " ";
}
cout << endl;
cout << "befor push: capacity is " << book.capacity() << " size is " << book.size() << endl;
char chTemp[1024] = {0};
for (int i=0; i != 5; i++){
sprintf(chTemp, "app_%d", i);
book.push_back(chTemp);
cout << "capacity is " << book.capacity() << " size is " << book.size() << endl;
}
for (auto it = book.begin(); it != book.end(); it++){
cout << *it << " ";
}
cout << endl;
int popNum = book.size() -1;
for (int i=0; i != popNum; i++){
book.pop_back();
cout << "after pop" << i << ": capacity is " << book.capacity() << " size is " << book.size() << endl;
}
for (auto it = book.begin(); it != book.end(); it++){
cout << *it << " ";
}
cout << endl;
cout << str << endl;
return 0;
}