|
Revision 477, 0.6 kB
(checked in by mido, 16 years ago)
|
|
panove, vite, jak jsem peclivej na upravu kodu.. snad se vam bude libit:) konfigurace je v souboru /system/astylerc
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | #include <itpp/itbase.h> |
|---|
| 2 | |
|---|
| 3 | using namespace itpp; |
|---|
| 4 | |
|---|
| 5 | //These lines are needed for use of cout and endl |
|---|
| 6 | using std::cout; |
|---|
| 7 | using std::endl; |
|---|
| 8 | |
|---|
| 9 | int main() { |
|---|
| 10 | //Declare the scalars used: |
|---|
| 11 | long i, sum, N; |
|---|
| 12 | |
|---|
| 13 | //Declare tt as an instance of the timer class: |
|---|
| 14 | Real_Timer tt; |
|---|
| 15 | |
|---|
| 16 | //Initiate the variables: |
|---|
| 17 | N = 1000000; |
|---|
| 18 | sum = 0; |
|---|
| 19 | |
|---|
| 20 | //Start and reset the timer: |
|---|
| 21 | tt.tic(); |
|---|
| 22 | |
|---|
| 23 | //Do some processing |
|---|
| 24 | for ( i = 0; i < N; i++ ) { |
|---|
| 25 | sum += i; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | // Print the elapsed time |
|---|
| 29 | tt.toc_print(); |
|---|
| 30 | |
|---|
| 31 | //Print the result of the processing: |
|---|
| 32 | cout << "The sum of all integers from 0 to " << N - 1 << " equals " << sum << endl; |
|---|
| 33 | |
|---|
| 34 | //Exit program: |
|---|
| 35 | return 0; |
|---|
| 36 | |
|---|
| 37 | } |
|---|