Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- typedef struct cellule cellule ;
- struct cellule {
- Tpage val;
- cellule *suiv;
- };
- typedef struct cellule liste;
- struct Page {
- char nom_proprietaire[10];
- int date_creation, nombre_visites;
- };typedef struct Page Tpage;
- void remplir (int T[],int n)
- {
- int i;
- for (i=0;i<n;i++)
- {
- T[i]=1;
- }
- }
- void affiche1(Tpage pages)
- {
- printf("%s | %d | %d\n",pages.nom_proprietaire,pages.date_creation,pages.nombre_visites);
- }
- void Ajoutpage2(Tpage *page) {
- printf("Saisir le nom du prop:\n");
- scanf("%s", page->nom_proprietaire);
- printf("Saisir la date de creation:\n");
- scanf("%d", &page->date_creation);
- printf("Saisir le nombre d'internautes:\n");
- scanf("%d", &page->nombre_visites);
- }
- void Ajoutpage3(liste **head) {
- if (head == NULL) {
- head = malloc(sizeof(Node));
- printf("Saisir le nom du prop:\n");
- scanf("%s", head->nom_proprietaire);
- printf("Saisir la date de creation:\n");
- scanf("%d", &head->date_creation);
- printf("Saisir le nombre d'internautes:\n");
- scanf("%d", &head->nombre_visites);
- } else {
- Node* current = head;
- while (current->next != NULL) {
- current = current->next;
- }
- Node* newPage = malloc(sizeof(Node));
- current->next = newPage;
- printf("Saisir le nom du prop:\n");
- scanf("%s", newPage->nom_proprietaire);
- printf("Saisir la date de creation:\n");
- scanf("%d", &newPage->date_creation);
- printf("Saisir le nombre d'internautes:\n");
- scanf("%d", &newPage->nombre_visites);
- }
- }
- int main ()
- {
- int T[20];
- int n;
- liste **head;
- Tpage p;
- Ajoutpage2 (&p);
- affiche1 (p);
- ajoutpage3(&head);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement