Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73103 - sandbox/SOC/2011/checks/libs/checks/example
From: pierre.talbot.6114_at_[hidden]
Date: 2011-07-14 10:40:50


Author: trademark
Date: 2011-07-14 10:40:49 EDT (Thu, 14 Jul 2011)
New Revision: 73103
URL: http://svn.boost.org/trac/boost/changeset/73103

Log:
Update of example, still obsolete. Will be soon updated again.
Text files modified:
   sandbox/SOC/2011/checks/libs/checks/example/isbn_example.cpp | 25 +++++--------------------
   sandbox/SOC/2011/checks/libs/checks/example/modulus_example.cpp | 11 ++++++++++-
   2 files changed, 15 insertions(+), 21 deletions(-)

Modified: sandbox/SOC/2011/checks/libs/checks/example/isbn_example.cpp
==============================================================================
--- sandbox/SOC/2011/checks/libs/checks/example/isbn_example.cpp (original)
+++ sandbox/SOC/2011/checks/libs/checks/example/isbn_example.cpp 2011-07-14 10:40:49 EDT (Thu, 14 Jul 2011)
@@ -15,6 +15,7 @@
 // Caution: this file contains Quickbook markup as well as code
 // and comments: don't change any of the special comment markups!
 
+#include <Windows.h>
 #include <iostream>
 using std::cout;
 using std::cin;
@@ -29,13 +30,11 @@
 #include <string>
 using std::string;
 #include <cassert>
-
 #include <boost/checks/checks_fwd.hpp> // Forward declarations.
 
 //[checks_isbn_example_1
 #include <boost/checks/ISBN_PAB.hpp> // ISBN for books (Old PAB version using just string parameter).
 //] [/checks_isbn_example_1]
-
 // This is a really, really trivial example, but shows how to imbed into Quickbook tutorial section.
 
 // You need to [import isbn_example.cpp]
@@ -45,30 +44,16 @@
 
 int main()
 {
-
 //[checks_isbn_example_2
- string s1 = "0201700735";
-
- cout << "ISBN " << s1 << (ISBNcheck(s1) ? " is OK" : " is Wrong!") << endl;
+ string s1 = "1232563456465";
+
+ //cout << "ISBN " << s1 << (ISBNcheck(s1) ? " is OK" : " is Wrong!") << endl;
 
   string s2 = "020170073";
 
   cout << "Check digit of " << s2 << " is " << ISBNcompute("020170073") << endl;
 
+ Sleep(5000);
 //] [/checks_isbn_example_2]
   
 } // int main()
-
-/*
-
-Output
-//[checks_isbn_output_1
-
- ISBN 0201700735 is OK
- Check digit of 020170073 is 5
-
-//] [/checks_isbn_output_1]
-
-
-*/
-

Modified: sandbox/SOC/2011/checks/libs/checks/example/modulus_example.cpp
==============================================================================
--- sandbox/SOC/2011/checks/libs/checks/example/modulus_example.cpp (original)
+++ sandbox/SOC/2011/checks/libs/checks/example/modulus_example.cpp 2011-07-14 10:40:49 EDT (Thu, 14 Jul 2011)
@@ -77,6 +77,13 @@
   example1();
 
   // Other tests / examples - Obsolete.
+
+ // std::string mod10_test = "471-9-5120-0288-";
+ std::string mod11_test = "12345678910";
+ unsigned int w[] = {1,2,3,4};
+ std::cout << "mod11 : " << boost::checks::compute_mod11( mod11_test.begin(), mod11_test.end(), 11) << std::endl;
+ //std::cout << "mod11 : " << boost::checks::check_mod11( mod11_test.begin(), mod11_test.end(), 9) << std::endl;
+
   std::string luhn_transposition = "12345678900"; // even
   std::cout << "ok : "<< boost::checks::compute_luhn( luhn_transposition.begin(), luhn_transposition.end(), luhn_transposition.size() ) << std::endl;
   luhn_transposition = "173456289003"; // even
@@ -85,9 +92,11 @@
   test(NULL);
 
   std::string luhn2 = "1234567814";
+ std::cout << luhn2[1] << luhn2[2] << std::endl;
   std::wstring luhn1(luhn2.begin(), luhn2.end());
+ std::cout << luhn1[1] << luhn1[2] << std::endl;
   std::wstring::iterator iter1 = luhn1.begin();
- wchar_t w = f<wchar_t>(luhn1.begin(), luhn1.end());
+// wchar_t w = f<wchar_t>(luhn1.begin(), luhn1.end());
  // std::cout << w;
 
  std::string luhn_alterate = "1234567871";


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk