1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
|
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
using std::cout;
using std::cin;
struct Event
{
struct Event *next;
char Veranstaltungsort[20];
char Datum[11];
};
void AusgabeListe(struct Event *e)
{
//hier kommt die Ausgabefunktion hin
}
int main(int argc, char*argv[])
{
struct Event *erstes, *momentan;
char ort[20], datum[11];
erstes = (struct Event*)malloc(sizeof(struct Event));
if(erstes == NULL) //kein Speicherplatz vorhanden
return 1;
momentan = erstes;
while(1)
{
cout << "Veranstaltungsort? ";
cin >> ort;
if(strlen(ort) < 2) break;
cout << "Datum? ";
cin >> datum;
momentan->next = (struct Event*)malloc(sizeof(struct Event));
if(momentan == NULL) //kein Speicherplatz vorhanden
return 1;
momentan = momentan->next;
momentan->next = NULL;
strcpy(momentan->Datum, datum);
strcpy(momentan->Veranstaltungsort, ort);
}
AusgabeListe(erstes->next);
getch();
return 0;
} |