-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Completed printAll function - Still needs more testing. Also modified…
… the main function in project5.cc
- Loading branch information
1 parent
e8066d7
commit d3689fd
Showing
4 changed files
with
105 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,51 @@ | ||
/** | ||
* @file project5.cc | ||
* @author Elijah Opoku-Nyarko and Jake Colbert | ||
* @brief | ||
* @version 0.1 | ||
* @date 2022-04-14 | ||
* | ||
* @copyright Copyright (c) 2022 | ||
* | ||
* Project 5 main file | ||
*/ | ||
/* | ||
* @file: project5.cc | ||
* | ||
*@brief: | ||
* Main program for CPS222 project 5 - test driver to read in a graph | ||
* from standard input and test the read graph | ||
* | ||
* @Authors: Elijah Opoku-Nyarko & Jake Colbert | ||
*/ | ||
|
||
#include <iostream> | ||
#include <string> | ||
#include <fstream> | ||
|
||
#include "province.h" | ||
#include "./province.h" | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
while(!cin.eof()) { | ||
Province theProvince(cin); | ||
theProvince.printAll(0, cout); | ||
} | ||
/* | ||
* check if we are at the end of the file | ||
*/ | ||
bool eof() { | ||
char c; | ||
std::cin >> c; | ||
// if the fie is ended, return true | ||
if (std::cin.eof()) { | ||
return true; | ||
} else { | ||
// if the file contains more data, return the previously gotten | ||
// data to cin | ||
std::cin.unget(); | ||
return false; | ||
} | ||
} | ||
|
||
int main(int argc, char *argv[]) { | ||
// Repeatedly read input from standard input | ||
while (!eof()) { | ||
// create a new graph for each loop, which will read all of the | ||
// corresponding data per graph | ||
Province theProvince(cin); | ||
|
||
std::cout << std::endl; | ||
std::cout << "------------------------------------------------" << std::endl; | ||
std::cout << "---------------- New DataSet: ------------------" << std::endl; | ||
std::cout << "------------------------------------------------" << std::endl; | ||
std::cout << std::endl; | ||
|
||
theProvince.printAll(0, cout); | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,39 @@ | ||
This is the name: 0x600000610008 | ||
This is the name: 0x600000610038 | ||
This is the name: 0x600000610068 | ||
This is the name: 0x600000610098 | ||
This is the name: 0x6000006100c8 | ||
|
||
------------------------------------------------ | ||
---------------- New DataSet: ------------------ | ||
------------------------------------------------ | ||
|
||
The input data is: | ||
|
||
Salem | ||
This is the name: 0x600001110008 | ||
This is the name: 0x600001110038 | ||
Beverly 2.4 mi via bridge | ||
Danvers 3.7 mi via bridge | ||
Lynn 4.9 mi | ||
Beverly | ||
Danvers 2.9 mi | ||
Salem 2.4 mi via bridge | ||
Wenham 5.2 mi | ||
Danvers | ||
Beverly 2.9 mi | ||
Wenham 4.2 mi | ||
Salem 3.7 mi via bridge | ||
Lynn | ||
Salem 4.9 mi | ||
Wenham | ||
Beverly 5.2 mi | ||
Danvers 4.2 mi | ||
|
||
|
||
|
||
------------------------------------------------ | ||
---------------- New DataSet: ------------------ | ||
------------------------------------------------ | ||
|
||
The input data is: | ||
|
||
Wenham | ||
This is the name: 0x600001110078 | ||
This is the name: 0x6000011100a8 | ||
The input data is: | ||
Hamilton 1 mi | ||
Hamilton | ||
Wenham 1 mi | ||
|
||
|
||
|