Advertisement
seld1

Untitled

May 7th, 2021
957
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.23 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <iostream>
  3. #include <Windows.h>
  4. #include <fstream>
  5. #include <string>
  6. using namespace std;
  7.  
  8. struct Model {
  9.     string FName;
  10.     string LName;
  11.     string SName;
  12.     std::string Sex;
  13.     std::string Nation;
  14.     std::string Height;
  15.     std::string Weight;
  16.  
  17.     std::string Year;
  18.     std::string Month;
  19.     std::string Day;
  20.  
  21.     std::string Index;
  22.     std::string Country;
  23.     std::string Area;
  24.     std::string District;
  25.     std::string City;
  26.     std::string Street;
  27.     std::string House;
  28.     std::string Flat;
  29.  
  30.  
  31. };
  32. void main()
  33. {
  34.     setlocale(LC_ALL, "Ru");
  35.     SetConsoleCP(1251);
  36.     SetConsoleOutputCP(1251);
  37.     std::string Path= "C:\\Users\\dan08\\Desktop\\tt.txt";
  38.     ifstream file(Path);
  39.     std::string word;
  40.     Model* Array;
  41.     if (file.is_open()) {
  42.  
  43.         getline(file,word);
  44.         int c = atoi(word.c_str());
  45.         Array = new Model[c];
  46.  
  47.         for (int i = 0; i < c; i++) {
  48.  
  49.             Model *m = new Model();
  50.             getline(file, word);
  51.             m->LName=word;
  52.             getline(file, word);
  53.             m->FName = word;
  54.             getline(file, word);
  55.             m->SName = word;
  56.             getline(file, word);
  57.             m->Sex = word;
  58.             getline(file, word);
  59.             m->Nation = word;
  60.             getline(file, word);
  61.             m->Height = word;
  62.             getline(file, word);
  63.             m->Weight = word;
  64.             getline(file, word);
  65.             m->Year = word;
  66.             getline(file, word);
  67.             m->Month = word;
  68.             getline(file, word);
  69.             m->Day = word;
  70.             getline(file, word);
  71.             m->Index = word;
  72.             getline(file, word);
  73.             m->Country = word;
  74.             getline(file, word);
  75.             m->Area = word;
  76.             getline(file, word);
  77.             m->District = word;
  78.             getline(file, word);
  79.             m->City = word;
  80.             getline(file, word);
  81.             m->Street = word;
  82.             getline(file, word);
  83.             m->House = word;
  84.             getline(file, word);
  85.             m->Flat = word;
  86.             getline(file, word);
  87.             Array[i] = *m;
  88.            
  89.         }
  90.  
  91.     }
  92.    
  93.    
  94. }
  95.  
  96.  
  97.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement