コード例 #1
0
 int main(int /*argc*/, char** /*argv*/) {
     std::cout << "Hello world!" << std::endl;
  
     double x = 5.5;
     double cap = 5.0;
     double x_capped = ImposeCap(x, cap);
     std::cout << "x is " << x << ", cap is " << cap << std::endl;
     std::cout << "The capped value of x is " << x_capped << std::endl;
  
     return EXIT_SUCCESS;
 }
コード例 #2
0
int main(int /*argc*/, char** /*argv*/) {
    std::cout << "Hello world!" << std::endl;
 
    std::string opts = ReadFileIntoString("ImposeCap.input");
    OptionParser parser(opts);
    double x = parser.Get<double>("Value");
    double cap = parser.Get<double>("Cap");
    double x_capped = ImposeCap(x, cap);
    std::cout << "x is " << x << ", cap is " << cap << std::endl;
    std::cout << "The capped value of x is " << x_capped << std::endl;
 
    return EXIT_SUCCESS;
}