lib for realtimeMM funcs
Fork of realtimeMMLib by
mmdevice.cpp@1:13301255d95a, 2018-02-15 (annotated)
- Committer:
- GTNicholson
- Date:
- Thu Feb 15 16:35:50 2018 +0000
- Revision:
- 1:13301255d95a
- Parent:
- 0:9f82ee1feae7
v4 lib
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GTNicholson | 0:9f82ee1feae7 | 1 | #include "mmdevice.h" |
GTNicholson | 0:9f82ee1feae7 | 2 | #include <utility> // std::pair, std::make_pair |
GTNicholson | 0:9f82ee1feae7 | 3 | #include <string> // std::string |
GTNicholson | 0:9f82ee1feae7 | 4 | #include <iostream> // std::cout |
GTNicholson | 0:9f82ee1feae7 | 5 | |
GTNicholson | 0:9f82ee1feae7 | 6 | |
GTNicholson | 0:9f82ee1feae7 | 7 | int mmdevice::getdata() |
GTNicholson | 0:9f82ee1feae7 | 8 | { |
GTNicholson | 0:9f82ee1feae7 | 9 | std::pair <std::string,double> product1; // default constructor |
GTNicholson | 0:9f82ee1feae7 | 10 | std::pair <std::string,double> product2 ("tomatoes",2.30); // value init |
GTNicholson | 0:9f82ee1feae7 | 11 | std::pair <std::string,double> product3 (product2); // copy constructor |
GTNicholson | 0:9f82ee1feae7 | 12 | |
GTNicholson | 0:9f82ee1feae7 | 13 | product1 = std::make_pair(std::string("lightbulbs"),0.99); // using make_pair (move) |
GTNicholson | 0:9f82ee1feae7 | 14 | |
GTNicholson | 0:9f82ee1feae7 | 15 | product2.first = "shoes"; // the type of first is string |
GTNicholson | 0:9f82ee1feae7 | 16 | product2.second = 39.90; // the type of second is double |
GTNicholson | 0:9f82ee1feae7 | 17 | |
GTNicholson | 0:9f82ee1feae7 | 18 | std::cout << "The price of " << product1.first << " is $" << product1.second << '\n'; |
GTNicholson | 0:9f82ee1feae7 | 19 | std::cout << "The price of " << product2.first << " is $" << product2.second << '\n'; |
GTNicholson | 0:9f82ee1feae7 | 20 | std::cout << "The price of " << product3.first << " is $" << product3.second << '\n'; |
GTNicholson | 0:9f82ee1feae7 | 21 | return 1; |
GTNicholson | 0:9f82ee1feae7 | 22 | } |