Project help

this is myfile.txt for use as the starting point.

start 0 0 0 0
FarmersBestBank 0 135 0 0
Dante_s_Peak 0 0 0 285
Centurion_Hwy 32 0 50 0
Blockbuster 30 0 0 370
NiagraGiftStore 0 55 90 0
Warrens 0 0 85 100
Pavilion 135 0 0 0
OrionsCircle 75 45 0 0
WesternViewMMA 0 0 60 180
ShoppersOrganized 0 0 380 0


Output to a file (STUDENTID.txt) using a scale of 5:1 character-line representing the total distances to the different locations from start is ascending order (i.e. from nearest to farthest location from start)

i. Example LOCATIONS TOT CHARACTER LINE REPRESENTATION

OrionsCircle 120 ************************
FarmersBestBank 135 ***************************
Pavilion 135 ***************************
NiagraGiftStore 145 *****************************
Warrens 185 *********************************
WesternViewMMA 240 ************************************************ Dante_s_Peak 285 ********************************************************* Centurion_Hwy 370 ************************************************************************** ShoppersOrganized 380 ****************************************************************************** Blockbuster 400 ********************************************************************************
Clockwise




#include <fstream>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <conio.h>
#include <string>

using namespace std;
int main()
{
char a[1][10];
int b[2],c[3],d[4],e[5];

ifstream myfile ("ECC.txt");
ofstream output("0619279_TOTAL_DISTANCE.txt");

if (myfile.is_open())
{
while ( myfile.good() )
{

myfile>>a[1]>>b[2]>>c[3]>>d[4]>>e[5];
output.open("0619279_TOTAL_DISTANCE.txt");
//cout<<a<<"\t"<<b[2]<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\n";
cout<<a<<"\t"<<b[2]<<"\t"<<c[3]<<"\t"<<d[4]<<"\t"<<e[5]<<"\n" ;
/*b = North[1];
cout << North[1];
c = South[1];
cout << South[1];
d = East[1];
cout << East[1];
e = West[1];
cout <<West[1];*/
output.close();}
myfile.close();

}
else cout << "Unable to open file";
_getch();
return 0;
}


//int Total_Distance_Calculator(int North[],int South[],int East[], int West[], int d)
//{
// //Simply Add All Values from all these arrays
// return (North[d]+East[d]+South[d]+West[d]);
//}
Topic archived. No new replies allowed.