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 48 49 50 51 52 53 54 55 56 57 58 59 60 61
   |  
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
enum todo {add='a',remov='r',move='m',end='e'};
char days[7][10]={"monday","tuesday","wednesday","thursday","friday","saturday","sunday"};
char months[12][12]={"january","february","march","april","mai","june","july","august","september","october","november","december" };
 
struct date 
{
	char d[10],m[11];
	unsigned y;
};
struct client
{
	int num;
	char name[50],street[60];
	struct date limit;
	struct client *prev,*next;
 
};
void angabe(struct client *var);
int main (void)
{
	int i,j,k;
	enum todo test;
	char str1,str2;
	struct client *first,*last,*var1,*var2;
    first=malloc( sizeof(struct client) );
 
	first->num=0;
	do
	{
		printf("nb: a=add/r=remove/m=move/e=end\n");
		printf("what do you want to do? : ");
		scanf("%c",&test);
 
		switch (test)
		{
		case (int)'a': 
			{
				if ( first->num==0 )
				{
					var2=var1;
					first=last;
					first=var1;
				}
				else
				{
					var2=var1;
				}
				var1=malloc( sizeof(struct client) );
				last=var1;
				last->prev=var2;
				var2->next=last;
				last->num=last->prev->num+1;
				angabe(var1);
			};break;
		};
	} while (test!='e');
} | 
Partager