1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
#include <iostream>
#include<fstream>
#include "location.h"
ofstream outf("f:results-Output.txt", ios::out);
ifstream inf("f:results-Input.txt", ios::in);
int main()
{
location x,y(1),z(1,2);
std::cout<<"testing constructor"<<std::endl;
std::cout<<"x="<<x<<std::endl;
std::cout<<"y="<<y<<std::endl;
std::cout<<"z="<<z<<std::endl;
outf<<"testing constructor"<<std::endl;
outf<<"x="<<x<<std::endl;
outf<<"y="<<y<<std::endl;
outf<<"z="<<z<<std::endl;
std::cout<<"testing assign function"<<std::endl;
outf<<"testing assign function"<<std::endl;
x.assign(3,7);
y.assign(4,3);
std::cout<<"Enter a location for z (r,c)";
outf<<"Enter a location for z (r,c)";
std::cin>>z;
std::cout<<"x="<<x<<std::endl;
std::cout<<"y="<<y<<std::endl;
std::cout<<"z="<<z<<std::endl;
outf<<"x="<<x<<std::endl;
outf<<"y="<<y<<std::endl;
outf<<"z="<<z<<std::endl;
std::cout<<"testing == function"<<std::endl;
outf<<"testing == function"<<std::endl;
if (x==y)
std::cout<<"these points are equal"<<std::endl;
outf<<"these points are equal"<<std::endl;
else
std::cout<<"these points are not equal"<<std::endl;
outf<<"these points are not equal"<<std::endl;
z=y;
std::cout<<"testing = function"<<std::endl;
std::cout<<"z="<<z<<std::endl;
outf<<"testing = function"<<std::endl;
outf<<"z="<<z<<std::endl;
std::cout<<"testing WithinRectangle Function"<<std::endl;
outf<<"testing WithinRectangle Function"<<std::endl;
x.WithinRectangle(1,1);
y.WithinRectangle(10,10);
std::cout<<"the top left point is "<<x<<std::endl;
std::cout<<"The Bottom right point is "<<y<<std::endl;
outf<<"the top left point is "<<x<<std::endl;
outf<<"The Bottom right point is "<<y<<std::endl;
x=x.Row();
y=y.Row();
z=z.Row();
std::cout<<"testing row function"<<std::endl;
std::cout<<"x row="<<x<<std::endl;
std::cout<<"y row="<<y<<std::endl;
std::cout<<"z row="<<z<<std::endl;
outf<<"testing row function"<<std::endl;
outf<<"x row="<<x<<std::endl;
outf<<"y row="<<y<<std::endl;
outf<<"z row="<<z<<std::endl;
x.assign(3,7);
y.assign(4,3);
z.assign(4,3);
x=x.Colm();
y=y.Colm();
z=z.Colm();
std::cout<<"testing colm function"<<std::endl;
std::cout<<"x column="<<x<<std::endl;
std::cout<<"y column="<<y<<std::endl;
std::cout<<"z column="<<z<<std::endl;
outf<<"testing colm function"<<std::endl;
outf<<"x column="<<x<<std::endl;
outf<<"y column="<<y<<std::endl;
outf<<"z column="<<z<<std::endl;
x.assign(3,7);
y.assign(4,3);
z.assign(4,3);
x.inc(1,2);
y.inc(1,2);
z.inc(1,2);
std::cout<<"testing inc function"<<std::endl;
std::cout<<"x="<<x<<std::endl;
std::cout<<"y="<<y<<std::endl;
std::cout<<"z="<<z<<std::endl;
outf<<"testing inc function"<<std::endl;
outf<<"x="<<x<<std::endl;
outf<<"y="<<y<<std::endl;
outf<<"z="<<z<<std::endl;
system("pause");
return 0;
}
| |