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
|
#include <iostream>
#include <fstream>
#include <ostream>
#include <cmath>
#include <string>
#include <iomanip>
using namespace std;
void mainInfo(double & easting, double & northing, int & beginElevation, int & endElevation, int & rows, int & columns, int & eastSpace, int & northSpace, int & elevSpace);
void getInfoSame(double & easting, double & northing, int & beginElevation, int & endElevation, int & rows, int & columns, int & eastSpace, int & northSpace, int & elevSpace);
void getInfoDiff();
//===============================MAIN====================================
//=======================================================================
int main()
{
double easting;
double northing;
int beginElevation;
int endElevation;
int rows;
int columns;
int eastSpace;
int northSpace;
int elevSpace;
char rowAnswer;
mainInfo(easting, northing, beginElevation, endElevation, rows, columns, eastSpace, northSpace, elevSpace);
cout << "Will the elevation of each row the same? (Y or N)";
cin >> rowAnswer;
if (toupper(rowAnswer)=='Y')
{
getInfoSame(easting, northing, beginElevation, endElevation,rows, columns, eastSpace, northSpace, elevSpace);
}
else
getInfoDiff();
return 0;
}
//=============mainInfo==============================
//Description: Ask the user information: Starting Easting, Starting Northing, How many rows and columns, spacing between rows and anc columns, starting and stop elevation
//
//Precondiction: Variables are passed through reference.
//
//Postcondition: Variables are passed back through reference.
//====================================================
void mainInfo(double & easting, double & northing, int & beginElevation,int & endElevation, int & rows, int & columns, int & eastSpace, int & northSpace, int & elevSpace)
{
cout << "What is your starting Easting point: ";
cin >> easting;
cout << "\nWhat is the Easting spacing: ";
cin >> eastSpace;
cout << "\nWhat is your starting Northing point: ";
cin >> northing;
cout << "\nWhat is the Northing spacing: ";
cin >> northSpace;
cout << "\nHow many columns will there be: ";
cin >> columns;
cout << "\nHow many rows will there be: ";
cin >> rows;
}
//=============mainInfo==============================
//Description: This function will export data to a data file.
//
//Precondiction: Variables are passed through reference.
//
//Postcondition: Nothing
//====================================================
void getInfoSame(double & easting, double & northing, int & beginElevation, int & endElevation, int & rows, int & columns, int & eastSpace, int & northSpace, int & elevSpace)
{
ofstream outFile;
int injPoint = 1;
int depth=1;
double eastingCount;
system("cls");
cout << "What is the beginning elevation: ";
cin >> beginElevation;
cout << "What is the ending elevation: ";
cin >> endElevation;
outFile.open("z:\\Outfiles\\Outfile.csv");
outFile << "x\ty\tElevation\t@@InjectionPoint\tInj_Point\n";
outFile << "depth\tfeet\n";
outFile << "=count(A4:A10000)\t1\n";
for(int i=0;i<=rows;i++)
{
for(int j=0;j<=columns;j++)
{
for(beginElevation;beginElevation<=endElevation;beginElevation++)
{
outFile << easting << "\t" << northing << "\t" << beginElevation << "\t1" << "\t" << "Inj_Point-" << injPoint << endl;
}
injPoint=injPoint + 1;
easting = easting + eastSpace;
}
northing = northing + northSpace;
}
outFile.close();
}
|