Website Summary Files Commits Branches @commit @diff @stats
path: root / pract KN / week2 / relation.cpp
diff options
context:
space:
mode:
Commit093dd92f916be9069cc267bb647671a5c7bcfb33 (patch)
Author
 Stoycho Kyosev <68247567+stoychoX@users.noreply.github.com>
2022-03-07 17:01:44 +0200
Committer
 GitHub <noreply@github.com>
2022-03-07 17:01:44 +0200
Files1c6e655662fa8f34f9db4d418d459c3dac9ed928 /pract KN/week2/relation.cpp
Object-oriented_programming_FMI-093dd92f916be9069cc267bb647671a5c7bcfb33.tar
Object-oriented_programming_FMI-093dd92f916be9069cc267bb647671a5c7bcfb33.tar.gz
Object-oriented_programming_FMI-093dd92f916be9069cc267bb647671a5c7bcfb33.zip
Parent73004f08a00927d8541726e4ae5267382b92ef2f (diff)
Update relation.cpp
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;