Advertisement
LOVEGUN

tessttt

May 20th, 2022
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. typedef struct cellule cellule ;
  5.  
  6. struct cellule {
  7. Tpage val;
  8. cellule *suiv;
  9. };
  10.  
  11. typedef struct cellule liste;
  12.  
  13. struct Page {
  14. char nom_proprietaire[10];
  15. int date_creation, nombre_visites;
  16. };typedef struct Page Tpage;
  17.  
  18.  
  19. void remplir (int T[],int n)
  20. {
  21. int i;
  22. for (i=0;i<n;i++)
  23. {
  24. T[i]=1;
  25. }
  26. }
  27. void affiche1(Tpage pages)
  28. {
  29. printf("%s | %d | %d\n",pages.nom_proprietaire,pages.date_creation,pages.nombre_visites);
  30. }
  31.  
  32.  
  33. void Ajoutpage2(Tpage *page) {
  34. printf("Saisir le nom du prop:\n");
  35. scanf("%s", page->nom_proprietaire);
  36. printf("Saisir la date de creation:\n");
  37. scanf("%d", &page->date_creation);
  38. printf("Saisir le nombre d'internautes:\n");
  39. scanf("%d", &page->nombre_visites);
  40. }
  41. void Ajoutpage3(liste **head) {
  42.  
  43. if (head == NULL) {
  44. head = malloc(sizeof(Node));
  45. printf("Saisir le nom du prop:\n");
  46. scanf("%s", head->nom_proprietaire);
  47. printf("Saisir la date de creation:\n");
  48. scanf("%d", &head->date_creation);
  49. printf("Saisir le nombre d'internautes:\n");
  50. scanf("%d", &head->nombre_visites);
  51. } else {
  52. Node* current = head;
  53. while (current->next != NULL) {
  54. current = current->next;
  55. }
  56. Node* newPage = malloc(sizeof(Node));
  57. current->next = newPage;
  58. printf("Saisir le nom du prop:\n");
  59. scanf("%s", newPage->nom_proprietaire);
  60. printf("Saisir la date de creation:\n");
  61. scanf("%d", &newPage->date_creation);
  62. printf("Saisir le nombre d'internautes:\n");
  63. scanf("%d", &newPage->nombre_visites);
  64. }
  65. }
  66. int main ()
  67. {
  68. int T[20];
  69. int n;
  70. liste **head;
  71.  
  72. Tpage p;
  73. Ajoutpage2 (&p);
  74. affiche1 (p);
  75. ajoutpage3(&head);
  76.  
  77.  
  78.  
  79. }
  80.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement