cpp11/auto.cc

29 lines
451 B
C++
Raw Normal View History

2012-05-05 12:45:44 -07:00
#include <vector>
#include <string>
#include <iostream>
2012-05-05 13:54:38 -07:00
using namespace std;
2012-05-05 12:45:44 -07:00
2012-05-05 13:54:38 -07:00
const vector<string> mcquays = {
2012-05-05 12:45:44 -07:00
"stephen",
"michael",
"bryan",
"derek",
};
int func() {
return 42;
}
int main() {
auto i = 5;
auto j = func();
2012-05-05 13:54:38 -07:00
auto s = string{"hello world"};
cout << i << " " << j << " " << s << endl;
2012-05-05 12:45:44 -07:00
for(auto it = mcquays.begin();
it != mcquays.end(); it++) {
2012-05-05 13:54:38 -07:00
cout << *it << endl;
2012-05-05 12:45:44 -07:00
}
}