dos_compilers/Zortech C++ v206/SAMPLE/VECTEST.CPP
2024-07-02 07:30:38 -07:00

42 lines
667 B
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// File Vectest.cpp
///////////////////////////////////////
// This is a test of the Vector data type
#include <stream.hpp>
#include "vector.hpp"
main()
{
Vector a(4), b;
a[0] = 1;
a[1] = 2;
a[2] = -5;
a[3] = a[2];
for (int i = 0; i < a.ub()+1; i++)
cout << "a[" << i << "] = " << a[i] << "\n";
b = a;
for (i = 0; i < b.ub()+1; i++)
cout << "b[" << i << "] = " << b[i] << "\n";
Vector c = a;
for (i = 0; i < c.ub()+1; i++)
cout << "c[" << i << "] = " << c[i] << "\n";
c = a + b;
for (i = 0; i < c.ub()+1; i++)
cout << "c[" << i << "] = " << c[i] << "\n";
b[5] = a[5];
cout << "done\n";
}