declaration-structure/decl-str-3.cc - More examples of declarations. | Lecture 2 - slide 6 : 29 Program 1 |
// Compilation: g++ -c -std=c++11 decl-str-3.cc #include <iostream> #include <string> #include "point.h" struct Pair{int a, b;}; int main(){ unsigned int i = 7; const double d = 5.7; std::string str[] = {"This", "is", "a", "string", "array"}; extern short int ei; bool is_even(int a); Point p1(1,2); // Old style constructor syntax Point p2{3,4}; // New universal style initialization, "list initializer" Pair q1 = {5,6}; // Membervise initialization Pair q2{7,8}; // Ditto }