Revision: 38648
Updated Code
at January 6, 2011 06:12 by kapocrnic
Updated Code
#include "a.h" #include <iostream> using namespace std; int main() { tree drvce; cout << "Inicijalizacija" << endl; InitT("korijen", &drvce); cout << "Label korijena: " << LabelT(RootT(&drvce), &drvce) << endl; cout << "Stvaranje troje djece korijenu." << endl; int prvo, drugo, trece; prvo = CreateT("prvo", RootT(&drvce), &drvce); drugo = CreateT("drugo", RootT(&drvce), &drvce); trece = CreateT("trece", RootT(&drvce), &drvce); cout << "Ispis njihovih indeksa i labela." << endl; cout << prvo << " " << LabelT(prvo, &drvce) << endl; cout << drugo << " " << LabelT(drugo, &drvce) << endl; cout << trece << " " << LabelT(trece, &drvce) << endl; cout << "Ispis ns od elementa \"2 prvo\"\n"; cout << NextSiblingT(prvo, &drvce) << " "; cout << LabelT(NextSiblingT(prvo, &drvce), &drvce) << endl; cout << "Ispis ns od elementa \"3 drugo\"\n"; cout << NextSiblingT(drugo, &drvce) << " "; cout << LabelT(NextSiblingT(drugo, &drvce), &drvce) << endl; cout << "Dodavanje dvoje djece na element \"3 drugo\"" << endl; CreateT("prvo od drugog", drugo, &drvce); CreateT("drugo od drugog", drugo, &drvce); cout << "Brisanje elemeta \"3 drugo\"\n"; DeleteT(drugo, &drvce); cout << "Ispis elementa \"prvo\" i njegovog ns\n"; cout << prvo << " " << LabelT(prvo, &drvce) << endl; cout << LabelT(NextSiblingT(prvo, &drvce), &drvce) << endl; cout << "Roditelj elementa \"prvo\" je: " << LabelT(ParentT(prvo, &drvce), &drvce) << endl; cout << "Mijenjamo label korijena" << endl; ChangeLabelT("NoviLabel", RootT(&drvce), &drvce); cout << "Roditelj elementa \"prvo\" je: " << LabelT(ParentT(prvo, &drvce), &drvce) << endl; cout << "Bye bye!" << endl; return 0; }
Revision: 38647
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 6, 2011 04:03 by kapocrnic
Initial Code
#include "a.h" #include <iostream> using namespace std; int main() { tree drvce; cout << "Inicijalizacija" << endl; InitT("korijen", &drvce); cout << "Label korijena: " << LabelT(RootT(&drvce), &drvce) << endl; cout << "Stvaranje troje djece korijenu." << endl; int prvo, drugo, trece; prvo = CreateT("prvo", RootT(&drvce), &drvce); drugo = CreateT("drugo", RootT(&drvce), &drvce); trece = CreateT("trece", RootT(&drvce), &drvce); cout << "Ispis njihovih indeksa i labela." << endl; cout << prvo << " " << LabelT(prvo, &drvce) << endl; cout << drugo << " " << LabelT(drugo, &drvce) << endl; cout << trece << " " << LabelT(trece, &drvce) << endl; cout << "Ispis ns od elementa \"2 prvo\"\n"; cout << NextSiblingT(prvo, &drvce) << " "; cout << LabelT(NextSiblingT(prvo, &drvce), &drvce) << endl; cout << "Ispis ns od elementa \"3 drugo\"\n"; cout << NextSiblingT(drugo, &drvce) << " "; cout << LabelT(NextSiblingT(drugo, &drvce), &drvce) << endl; cout << "Dodavanje dvoje djece na element \"3 drugo\"" << endl; CreateT("prvo od drugog", drugo, &drvce); CreateT("drugo od drugog", drugo, &drvce); cout << "Brisanje elemeta \"3 drugo\"\n"; DeleteT(drugo, &drvce); cout << "Ispis elementa \"prvo\" i njegovog ns\n"; cout << prvo << " " << LabelT(prvo, &drvce) << endl; cout << LabelT(NextSiblingT(prvo, &drvce), &drvce) << endl; cout << "Roditelj elementa \"prvo\" je: " << LabelT(ParentT(prvo, &drvce), &drvce) << endl; cout << "Mijenjamo label korijena" << endl; ChangeLabelT("Sarma je zakon", RootT(&drvce), &drvce); cout << "Roditelj elementa \"prvo\" je: " << LabelT(ParentT(prvo, &drvce), &drvce) << endl; cout << "Bye bye!" << endl; return 0; }
Initial URL
Initial Description
Initial Title
Test za a zadatak
Initial Tags
Initial Language
C++