diff options
Create task3_temp.cpp
1 files changed, 69 insertions, 0 deletions
| -rw-r--r-- | Sem. 02/task3_temp.cpp | 69 |
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; + +} |
