Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit3c10018bbe6c85198e2fd94e1797d15e02cd0e37 (patch)
Author
 Angel Dimitriev <angel_dimitriev@abv.bg>
2022-03-01 20:45:08 +0200
Committer
 GitHub <noreply@github.com>
2022-03-01 20:45:08 +0200
Files9c0ea82273cef69647d61ab79b00c92d3c0ffc95
Object-oriented_programming_FMI-3c10018bbe6c85198e2fd94e1797d15e02cd0e37.tar
Object-oriented_programming_FMI-3c10018bbe6c85198e2fd94e1797d15e02cd0e37.tar.gz
Object-oriented_programming_FMI-3c10018bbe6c85198e2fd94e1797d15e02cd0e37.zip
Parent52cb013826a0fc5c03d1575cdbabdc549db83f7f (diff)
Create task3_temp.cpp
1 files changed, 69 insertions, 0 deletions
-rw-r--r--Sem. 02/task3_temp.cpp69
diff --git a/Sem. 02/task3_temp.cpp b/Sem. 02/task3_temp.cpp
new file mode 100644
index 0000000..910e8a1
--- /dev/null
+++ b/Sem. 02/task3_temp.cpp
@@ -0,0 +1,69 @@
+#include <iostream>
+#include <fstream>
+using namespace std;
+
+
+const size_t capacity = 1024;
+
+enum class Spec
+{
+ computerScience,
+ softEng
+};
+struct StudentRecord
+{
+ char firstName[capacity];
+ char lastName[capacity];
+ char fnRaw[capacity];
+
+ Spec spec;
+ int fn;
+
+ char email[capacity];
+};
+
+struct StudentCollection
+{
+ StudentRecord* data;
+};
+
+size_t getLinesCount(const char* fileName)
+{
+ ifstream file(fileName);
+
+ if (!file.is_open())
+ return 0;
+
+ size_t count = 0;
+
+ while (!file.eof())
+ {
+ char buff[capacity];
+ file.getline(buff, capacity);
+ count++;
+ }
+
+ file.close ();
+
+ return count;
+
+}
+
+int main()
+{
+
+ char inputFileName[] = "lists/si.csv";
+ size_t studentsCount = getLinesCount(inputFileName) - 1;
+
+ StudentCollection myCollection;
+ myCollection.data = new StudentRecord[studentsCount];
+
+
+ //parse
+ //...
+
+
+
+ delete[] myCollection.data;
+
+}