Changeset 4062 in Sophya for trunk/SophyaLib/BaseTools/pqnumber.cc
- Timestamp:
- Apr 27, 2012, 12:26:07 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/pqnumber.cc
r4056 r4062 15 15 \code 16 16 // Create a PrimeNumbers object 17 // Create a PrimeNumbers object 17 18 PrimeNumbers primes; 18 // Print the first 15 primes...19 for(size_t k=0; k<15; k++)20 cout << primes(k) << endl;19 // Print the prime numbers from rank 20 to 25 ... 20 cout << " Primes[20...30]: " ; 21 for(size_t k=19; k<30; k++) cout << primes(k) << " "; 21 22 // Print all prime numbers less than some max values 22 uint_8 p max = 223;23 uint_8 p = primes.Next();23 uint_8 p = primes.Next(); uint_8 pmax = 223; 24 cout << endl << " Primes < " << pmax << " : " << endl; 24 25 while (p<pmax) { 25 cout << p << endl;26 26 cout << p << " "; 27 p = primes.Next(); 27 28 } 29 cout << endl; 30 // Compute and print prime factor decomposition: 31 uint_8 nombre=247890; 32 vector<uint_8> pfac=primes.PrimeFactors(nombre, true); 33 cout << " PrimeFactors[" << nombre << "]: "; 34 for(size_t i=0; i<pfac.size(); i++) cout << pfac[i] << " "; 35 cout << endl; 28 36 \endcode 29 37 */ … … 266 274 267 275 \code 268 // Create rational numbers from integers276 // Create rational numbers from pairs of integers 269 277 QNumber q1(3,4), q2(5,6), q3(6,8); 270 278 // Operations and comparsion … … 272 280 cout << q1 << " + " << q2 << " = " << q4 << endl; 273 281 QNumber qa(q1), qb(q2); 274 cout " Test qa==qb : -> " << qa << " ?== " << qb;282 cout << " Test qa==qb : -> " << qa << " ?== " << qb; 275 283 if (qa == qb) cout << " -> true " << endl; 276 284 else cout << " -> false " << endl; 277 285 qb = q3; 278 cout " Test qa==qb : -> " << qa << " ?== " << qb;286 cout << " Test qa==qb : -> " << qa << " ?== " << qb; 279 287 if (qa == qb) cout << " -> true " << endl; 280 288 else cout << " -> false " << endl;
Note:
See TracChangeset
for help on using the changeset viewer.