#include "stdafx.h"
#include <iostream>
#include <string>
 
using namespace std;
 
struct item {
	string key;
	string val;
	item *next;
};
 
item *first;
item *last;
 
item* find(string k){
	item* p = first;
	while(p != NULL && p->key!=k)
	{
		p = p->next;
	}
	return p;	
}
 
 
void list(){
	item* p = first;
	cout << "Reading list." << endl;
	while(p != NULL)
	{
		cout << p->key << " , " << p->val << endl;
		p = p->next;
	}
}
void insertFirst(string k, string v){
 
	item* p	= new item;
	p->key = k;
	p->val = v;
	p->next = nullptr;
 
 
	if (last == nullptr)
		last = p;
	else
		p->next = first;
 
	first = p;
}
 
 
void insertLast(string k, string v){
 
	item* p	= new item;
	p->key = k;
	p->val = v;
	p->next = nullptr;
 
	if (first != nullptr)
	{
		last->next = p;
		last = p;
	}
	else
	{
		first = p;
		last = p;
	}
}
 
int _tmain(int argc, _TCHAR* argv[])
{
	cout << "Hello" << endl;
	first = NULL;
	last = nullptr;
 
	list();
 
	insertLast("petr", "1");
	list();
	insertLast("pavel", "2");
 
	list();
 
	search ("jan");
	search ("pavel");
	search ("petr");
	search ("vaclav");
 
 
	system ("pause");
 
	return 0;
 
 
}
 
seznam_ctvrtek.txt · Last modified: 2017/02/23 15:14 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