Skip to content

Instantly share code, notes, and snippets.

@kazmura11
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save kazmura11/99155376fad72a64d741 to your computer and use it in GitHub Desktop.

Select an option

Save kazmura11/99155376fad72a64d741 to your computer and use it in GitHub Desktop.
dll sample client code
#include "../BmiDll/Bmi.h"
#include <iostream>
#include <iomanip>
#include <vector>
using namespace MyUtil;
int main()
{
std::vector<Bmi *> bmi;
bmi.push_back(new Bmi("一郎", 1.71, 50.1));
bmi.push_back(new Bmi("二郎", 1.61, 60.2));
bmi.push_back(new Bmi("三郎", 1.65, 70.9));
bmi.push_back(new Bmi("四郎", 1.63, 80.7));
bmi.push_back(new Bmi("五郎", 1.62, 100.6));
bmi.push_back(new Bmi("六郎", 1.81, 140.3));
for (std::vector<Bmi *>::iterator it = bmi.begin(); it != bmi.end(); ++it)
{
std::cout << (*it)->getName() << "さんのBMIは"
<< std::setprecision(4) << (*it)->getBmi() << "で、"
<< (*it)->calc() << "です。" << std::endl;
}
for (std::vector<Bmi *>::iterator it = bmi.begin(); it != bmi.end(); ++it)
{
delete *it;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment