lib for realteimMM funcs
Diff: mmdevice.cpp
- Revision:
- 0:9f82ee1feae7
diff -r 000000000000 -r 9f82ee1feae7 mmdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevice.cpp Mon Oct 02 11:18:47 2017 +0000 @@ -0,0 +1,22 @@ +#include "mmdevice.h" +#include <utility> // std::pair, std::make_pair +#include <string> // std::string +#include <iostream> // std::cout + + +int mmdevice::getdata() +{ + std::pair <std::string,double> product1; // default constructor + std::pair <std::string,double> product2 ("tomatoes",2.30); // value init + std::pair <std::string,double> product3 (product2); // copy constructor + + product1 = std::make_pair(std::string("lightbulbs"),0.99); // using make_pair (move) + + product2.first = "shoes"; // the type of first is string + product2.second = 39.90; // the type of second is double + + std::cout << "The price of " << product1.first << " is $" << product1.second << '\n'; + std::cout << "The price of " << product2.first << " is $" << product2.second << '\n'; + std::cout << "The price of " << product3.first << " is $" << product3.second << '\n'; + return 1; +}