#include "stdafx.h" #include #include using namespace std; struct Color { string name; int r; int g; int b; Color * next; Color () : name (""), r(0), g (0), b (0), next (nullptr) {} Color(string name0, int r0, int g0, int b0) : name (name0), r(r0), g(g0), b(b0), next(nullptr) { } }; Color * first = nullptr; int main() { Color * p = new Color ("Modra", 0, 0, 255); // p->next = first; /* 1 */ // first = p; /* 2 */ p->next = nullptr; if (first == nullptr) first = p; else { Color * t = first; while (t->next != nullptr) { t = t->next; } t->next = p; } cout << "seznam" << endl; Color * u = first; while (u != nullptr ) { cout << u->name << ":" << u->r << ":" << u->g << ":" << u->b << endl; u = u->next; } system ("pause"); return 0; }