#include <iostream>
#include <fstream>
 
using namespace std;
 
const int MAX = 100;
 
struct Item
{
    string name;
    string addr;
 
};
 
struct List
{
 int cnt;
 Item data [MAX];
};
 
void clear (List & a)
{
  a.cnt = 0;
  for (int i = 0; i< MAX; i++)
  {
      a.data [i].name = "";
      a.data [i].addr = "";
  }
}
void insert (List & a, string name0, string addr0)
{
 
    int i = a.cnt;
    if (i < MAX)
    {
    a.cnt++;
    a.data [i].name = name0;
    a.data [i].addr = addr0;
    }
}
 
void tisk (List & a)
{
    for (int i = 0; i < a.cnt; i++ )
    {
        cout << a.data[i].name << " " << a.data[i].addr << endl;
    }
}
 
int main()
{
    List b;
    clear (b);
    insert (b, "amalka", "pod kopretinou");
    insert (b, "kremilek", "v parezu");
    tisk (b);
    cout << endl;
 
    // #include <fstream>
    ifstream f ("..\\untitled6\\lide.txt");
 
    while (f.good())
    {
        string x = "" , y = "";
        cout << "Vlozte jmeno:";
        f >> x;
        cout << x << endl;
        cout << "vlozte adresu:";
        f >> y;
        cout << y << endl;
        if (x != "")
        {
           insert (b, x, y);
        }
    }
 
    cout << endl;
    tisk (b);
    cout << endl;
 
 
    return 0;
}
 
seznam_pole.txt · Last modified: 2018/11/06 10:51 by 147.32.8.110
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki