home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
progjour
/
1990
/
05
/
vtest.cpp
< prev
next >
Wrap
Text File
|
1990-08-06
|
2KB
|
39 lines
#include "vint.cpp"
main ()
{
const int size = 5;
int result;
int i;
vint x = (long)size; //array of "size" ints
// load each element of the array with its own index
// then read the array back to verify
for (i=size; --i >= 0; x[i] = i)
;
for (i=size; --i >= 0; )
if ( (result = x[i]) == i )
cout << "x[" << i << "]==" << result << "\n";
// legal operators----------------->| |<-----------
cout << "x[3] = 3 = " << ( x[3] = 3 ) << "\n" ;
cout << "x[3] = " << ( (int)x[3] ) << "\n" ;
cout << "x[3] + 5 = " << ( x[3] + 5 ) << "\n" ;
cout << "x[3] - 5 = " << ( x[3] - 5 ) << "\n" ;
cout << "x[3] / 5 = " << ( x[3] / 5 ) << "\n" ;
cout << "x[3] * 5 = " << ( x[3] * 5 ) << "\n" ;
cout << "5 + x[3] = " << ( 5 + x[3] ) << "\n" ;
cout << "5 - x[3] = " << ( 5 - x[3] ) << "\n" ;
cout << "5 * x[3] = " << ( 5 * x[3] ) << "\n" ;
cout << "5 / x[3] = " << ( 5 / x[3] ) << "\n" ;
cout << "x[3] + x[3] = " << ( x[3] + x[3] ) << "\n" ;
cout << "x[3] - x[3] = " << ( x[3] - x[3] ) << "\n" ;
cout << "x[3] * x[3] = " << ( x[3] * x[3] ) << "\n" ;
cout << "x[3] / x[3] = " << ( x[3] / x[3] ) << "\n" ;
cout << "++x[3] = " << ( ++x[3] ) << "\n" ;
cout << "--x[3] = " << ( --x[3] ) << "\n" ;
}