Website Summary Files Commits Branches @commit @diff @stats
path: root / pract KN / week2 / relation.cpp
diff options
context:
space:
mode:
1 files changed, 5 insertions, 3 deletions
-rw-r--r--pract KN/week2/relation.cpp8
diff --git a/pract KN/week2/relation.cpp b/pract KN/week2/relation.cpp
index ce4ea84..8196724 100644
--- a/pract KN/week2/relation.cpp
+++ b/pract KN/week2/relation.cpp
@@ -34,8 +34,8 @@ void addPair(relation& toAdd, int first, int second) {
toAdd.data[toAdd.size++] = makePair(first, second);
}
-void writePair(const pair& p, std::ofstream& in) {
- in << p.first << " " << p.second << std::endl;
+void writePair(const pair& p, std::ofstream& out) {
+ out << p.first << " " << p.second << std::endl;
}
pair readPair(std::ifstream& in) {
@@ -63,7 +63,9 @@ relation readRelation() {
if (inFile.bad())
throw std::exception("Problem with reading the file");
-
+
+ // alternative to throw: return relation(); -> returns empty relation
+
relation toReturn;
int size = 0;
inFile >> size;