Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <Windows.h>
- #include <fstream>
- #include <string>
- using namespace std;
- struct Model {
- string FName;
- string LName;
- string SName;
- std::string Sex;
- std::string Nation;
- std::string Height;
- std::string Weight;
- std::string Year;
- std::string Month;
- std::string Day;
- std::string Index;
- std::string Country;
- std::string Area;
- std::string District;
- std::string City;
- std::string Street;
- std::string House;
- std::string Flat;
- };
- void main()
- {
- setlocale(LC_ALL, "Ru");
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- std::string Path= "C:\\Users\\dan08\\Desktop\\tt.txt";
- ifstream file(Path);
- std::string word;
- Model* Array;
- if (file.is_open()) {
- getline(file,word);
- int c = atoi(word.c_str());
- Array = new Model[c];
- for (int i = 0; i < c; i++) {
- Model *m = new Model();
- getline(file, word);
- m->LName=word;
- getline(file, word);
- m->FName = word;
- getline(file, word);
- m->SName = word;
- getline(file, word);
- m->Sex = word;
- getline(file, word);
- m->Nation = word;
- getline(file, word);
- m->Height = word;
- getline(file, word);
- m->Weight = word;
- getline(file, word);
- m->Year = word;
- getline(file, word);
- m->Month = word;
- getline(file, word);
- m->Day = word;
- getline(file, word);
- m->Index = word;
- getline(file, word);
- m->Country = word;
- getline(file, word);
- m->Area = word;
- getline(file, word);
- m->District = word;
- getline(file, word);
- m->City = word;
- getline(file, word);
- m->Street = word;
- getline(file, word);
- m->House = word;
- getline(file, word);
- m->Flat = word;
- getline(file, word);
- Array[i] = *m;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement