Advertisement
Guest User

PJ4

a guest
May 25th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 51.92 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #define TAILLE_MAX 150
  5.  
  6. typedef struct Motherboard{
  7.     char marque[TAILLE_MAX];
  8.     char modele[TAILLE_MAX];
  9.     char socket_proc[TAILLE_MAX];
  10.     char nbr_socket[TAILLE_MAX];
  11.     char nbr_ram[TAILLE_MAX];
  12.     char ver_ram[TAILLE_MAX];
  13.     char nbr_pci[TAILLE_MAX];
  14.     char nbr_ide[TAILLE_MAX];
  15.     char nbr_sata[TAILLE_MAX];
  16.     char nbr_usb[TAILLE_MAX];
  17.     char nbr_vga[TAILLE_MAX];
  18.     char nbr_dvi[TAILLE_MAX];
  19.     char nbr_reseau[TAILLE_MAX];
  20.     char format[TAILLE_MAX];
  21.     char usp[TAILLE_MAX];
  22.     char fiab[TAILLE_MAX];
  23.     char restrict[TAILLE_MAX];
  24.     char prix[TAILLE_MAX];
  25.     char conso_elec[TAILLE_MAX];
  26.     char overclock[TAILLE_MAX];
  27. }Motherboard;
  28.  
  29. typedef struct Graphics{
  30.  
  31.     char marque[TAILLE_MAX];//Marque
  32.     char modele[TAILLE_MAX];//Modèle
  33.     char nbr_vga[TAILLE_MAX];//Nombre de ports VGA
  34.     char nbr_dvi[TAILLE_MAX];//Nombre de ports DVI
  35.     char nbr_hdmi[TAILLE_MAX];//Nombre de ports HDMI
  36.     char nbr_minidp[TAILLE_MAX];//Nombre de ports MINIDP
  37.     char usp[TAILLE_MAX];//Unique Selling Points
  38.     char fiab[TAILLE_MAX];//Taux de fiabilité ( % de matériel vendu n'ayant pas montré de défaut)
  39.     char restrict[TAILLE_MAX];//Restrictions d'usage
  40.     char prix[TAILLE_MAX];//Prix
  41.     char perf[TAILLE_MAX];//Indice de performance
  42.     char conso_elec[TAILLE_MAX];//Consommation électrique
  43.     char overclock[TAILLE_MAX];//Coefficient d'overclocking (impacte les performances et la consommation)
  44. }Graphics;
  45.  
  46. typedef struct Hdd{
  47.     char marque[TAILLE_MAX];//Marque
  48.     char modele[TAILLE_MAX];//Modèle
  49.     char capa[TAILLE_MAX];//Espace disque (en Go)
  50.     char port[TAILLE_MAX];//Type de port
  51.     char usp[TAILLE_MAX];//Unique Selling Points
  52.     char fiab[TAILLE_MAX];//Taux de fiabilité ( % de matériel vendu n'ayant pas montré de défaut)
  53.     char restrict[TAILLE_MAX];//Restrictions d'usage
  54.     char prix[TAILLE_MAX];//Prix
  55.     char perf[TAILLE_MAX];//Indice de performance
  56.     char conso_elec[TAILLE_MAX];//Consommation électrique
  57. }Hdd;
  58.  
  59. typedef struct processeur{
  60.  
  61.     char marque[TAILLE_MAX];
  62.     char modele[TAILLE_MAX];
  63.     char socket[TAILLE_MAX];
  64.     char frequence[TAILLE_MAX];
  65.     char restriction[TAILLE_MAX];
  66.     char uniqueSellingPoint[TAILLE_MAX];
  67.     char nbemplacementRam[TAILLE_MAX];
  68.     char fiab[TAILLE_MAX];
  69.     char prix[TAILLE_MAX];
  70.     char indiceDePerf[TAILLE_MAX];
  71.     char consoElec[TAILLE_MAX];
  72.     char coefOverclock[TAILLE_MAX];
  73. }processeur;
  74.  
  75. typedef struct caracEcran{
  76.  
  77.     char marque[TAILLE_MAX];
  78.     char modele[TAILLE_MAX];
  79.     char taille[TAILLE_MAX];
  80.     char resolMax[TAILLE_MAX];
  81.     char typePort[TAILLE_MAX];
  82.     char uniqueSellingPoint[TAILLE_MAX];
  83.     char fiab[TAILLE_MAX];
  84.     char restriction[TAILLE_MAX];
  85.     char prix[TAILLE_MAX];
  86.     char indiceDePerf[TAILLE_MAX];
  87.     char consoElec[TAILLE_MAX];
  88. }caracEcran;
  89.  
  90. typedef struct Ram{
  91.  
  92.     char marque[TAILLE_MAX];
  93.     char modele[TAILLE_MAX];
  94.     char ver_ram[TAILLE_MAX];
  95.     char freq[TAILLE_MAX];
  96.     char ram_mod[TAILLE_MAX];
  97.     char fiab[TAILLE_MAX];
  98.     char restrict[TAILLE_MAX];
  99.     char prix[TAILLE_MAX];
  100.     char perform[TAILLE_MAX];
  101.     char cons_elec[TAILLE_MAX];
  102.     char overclock[TAILLE_MAX];
  103. }Ram;
  104.  
  105. typedef struct Soft{
  106.  
  107.     char soft[TAILLE_MAX];//Nom du logiciel
  108.     char ram[TAILLE_MAX];//RAM nécessaire
  109.     char rom[TAILLE_MAX];//Espace disque nécessaire
  110.     char puis_graph[TAILLE_MAX];//Puissance graphique nécessaire (X = aucun pré-requis)
  111.     char puis_proc[TAILLE_MAX];//Puissance processeur nécessaire
  112.     char usp[TAILLE_MAX];//Unique Selling Points nécessaires (X = aucun pré-requis)
  113. }Soft;
  114.  
  115. char** str_split(char* str, char delim){
  116.     // Define a function to do more than strtok
  117.     // str_split will return an array of all delimited string
  118.     char** ret;
  119.     int retLen;
  120.     char* c;
  121.  
  122.     if ((str == NULL ) || (delim == '\0'))
  123.     {
  124.         /* Either of those will cause problems */
  125.         ret = NULL;
  126.         retLen = -1;
  127.     }
  128.     else
  129.     {
  130.         retLen = 0;
  131.         c = str;
  132.  
  133.         /* Pre-calculate number of elements */
  134.         do
  135.         {
  136.             if (*c == delim)
  137.                 retLen++;
  138.  
  139.             c++;
  140.         } while (*c != '\0');
  141.  
  142.         ret = malloc((retLen + 1) * sizeof(*ret));
  143.         ret[retLen] = NULL;
  144.  
  145.         c = str;
  146.         retLen = 1;
  147.         ret[0] = str;
  148.  
  149.         do
  150.         {
  151.             if (*c == delim)
  152.             {
  153.                 ret[retLen++] = &c[1];
  154.                 *c = '\0';
  155.             }
  156.  
  157.             c++;
  158.         } while ( *c != '\0' );
  159.     }
  160.     return ret;
  161. }
  162.  
  163. void ouverture_motherboard(Motherboard motherboard_array[19]){
  164.     FILE* fichier = NULL;
  165.     char caractere[TAILLE_MAX];
  166.  
  167.     fichier = fopen("MOTHERBOARD.csv", "r");
  168.     if(fichier != NULL)
  169.     {
  170.     }
  171.     else
  172.     {
  173.         printf("impossible d'ouvrir le fichier");
  174.     }
  175.  
  176.     // Define our motherboard array to store all lines in CSV file
  177.  
  178.     int cpt = 0;
  179.     // get the whole line for each
  180.     while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
  181.     {
  182.         // Get all the strings delimited by a ';'
  183.         char ** array = str_split(caractere, ';');
  184.  
  185.         // Define a new structure
  186.         Motherboard motherboard;
  187.  
  188.         // copy the content of each properties in the structure
  189.         strcpy(motherboard.marque, array[0]);
  190.         strcpy(motherboard.modele, array[1]);
  191.         strcpy(motherboard.socket_proc, array[2]);
  192.         strcpy(motherboard.nbr_socket, array[3]);
  193.         strcpy(motherboard.nbr_ram, array[4]);
  194.         strcpy(motherboard.ver_ram, array[5]);
  195.         strcpy(motherboard.nbr_pci, array[10]);
  196.         strcpy(motherboard.nbr_ide, array[7]);
  197.         strcpy(motherboard.nbr_sata, array[8]);
  198.         strcpy(motherboard.nbr_usb, array[9]);
  199.         strcpy(motherboard.nbr_vga, array[10]);
  200.         strcpy(motherboard.nbr_dvi, array[11]);
  201.         strcpy(motherboard.nbr_reseau, array[12]);
  202.         strcpy(motherboard.format, array[13]);
  203.         strcpy(motherboard.usp, array[14]);
  204.         strcpy(motherboard.fiab, array[15]);
  205.         strcpy(motherboard.restrict, array[16]);
  206.         strcpy(motherboard.prix, array[17]);
  207.         strcpy(motherboard.conso_elec, array[18]);
  208.         strcpy(motherboard.overclock, array[19]);
  209.  
  210.         // add this structure in the array defined previousment
  211.         motherboard_array[cpt++] = motherboard;
  212.     }
  213.     fclose(fichier);
  214. }
  215.  
  216. void ouverture_graphics(Graphics graphics_array[12]){
  217.     FILE* fichier = NULL;
  218.     char caractere[TAILLE_MAX];
  219.  
  220.     fichier = fopen("GRAPHICS.csv", "r");
  221.     if(fichier != NULL)
  222.     {
  223.     }
  224.     else
  225.     {
  226.         printf("impossible d'ouvrir le fichier");
  227.     }
  228.  
  229.     // Define our graphics array to store all lines in CSV file
  230.  
  231.     int cpt = 0;
  232.     // get the whole line for each
  233.     while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
  234.     {
  235.         // Get all the strings delimited by a ';'
  236.         char ** array = str_split(caractere, ';');
  237.  
  238.         // Define a new structure
  239.         Graphics graphics;
  240.  
  241.         // copy the content of each properties in the structure
  242.         strcpy(graphics.marque, array[0]);
  243.         strcpy(graphics.modele, array[1]);
  244.         strcpy(graphics.nbr_vga, array[2]);
  245.         strcpy(graphics.nbr_dvi, array[3]);
  246.         strcpy(graphics.nbr_hdmi, array[4]);
  247.         strcpy(graphics.nbr_minidp, array[5]);
  248.         strcpy(graphics.usp, array[6]);
  249.         strcpy(graphics.fiab, array[7]);
  250.         strcpy(graphics.restrict, array[8]);
  251.         strcpy(graphics.prix, array[9]);
  252.         strcpy(graphics.perf, array[10]);
  253.         strcpy(graphics.conso_elec, array[11]);
  254.         strcpy(graphics.overclock, array[12]);
  255.  
  256.         // add this structure in the array defined previousment
  257.         graphics_array[cpt++] = graphics;
  258.     }
  259.     fclose(fichier);
  260. }
  261.  
  262. void ouverture_hdd(Hdd hdd_array[9]){
  263.     FILE* fichier = NULL;
  264.     char caractere[TAILLE_MAX];
  265.  
  266.     fichier = fopen("HDD.csv", "r");
  267.     if(fichier != NULL)
  268.     {
  269.     }
  270.     else
  271.     {
  272.         printf("impossible d'ouvrir le fichier");
  273.     }
  274.  
  275.     // Define our hdd array to store all lines in CSV file
  276.  
  277.     int cpt = 0;
  278.     // get the whole line for each
  279.     while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
  280.     {
  281.         // Get all the strings delimited by a ';'
  282.         char ** array = str_split(caractere, ';');
  283.  
  284.         // Define a new structure
  285.         Hdd hdd;
  286.  
  287.         // copy the content of each properties in the structure
  288.         strcpy(hdd.marque, array[0]);
  289.         strcpy(hdd.modele, array[1]);
  290.         strcpy(hdd.capa, array[2]);
  291.         strcpy(hdd.port, array[3]);
  292.         strcpy(hdd.usp, array[4]);
  293.         strcpy(hdd.fiab, array[5]);
  294.         strcpy(hdd.restrict, array[6]);
  295.         strcpy(hdd.prix, array[7]);
  296.         strcpy(hdd.perf, array[8]);
  297.         strcpy(hdd.conso_elec, array[9]);
  298.  
  299.         // add this structure in the array defined previousment
  300.         hdd_array[cpt++] = hdd;
  301.     }
  302.  
  303.     fclose(fichier);
  304. }
  305.  
  306. void ouverture_proco(processeur proco_array[11]){
  307.     FILE* fichier = NULL;
  308.     char caractere[TAILLE_MAX];
  309.  
  310.     fichier = fopen("PROCO.csv", "r");
  311.     if(fichier != NULL)
  312.     {
  313.     }
  314.     else
  315.     {
  316.         printf("impossible d'ouvrir le fichier");
  317.     }
  318.  
  319.     // Define our proco array to store all lines in CSV file
  320.  
  321.  
  322.     int cpt = 0;
  323.     // get the whole line for each
  324.     while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
  325.     {
  326.         // Get all the strings delimited by a ';'
  327.         char ** array = str_split(caractere, ';');
  328.  
  329.         // Define a new structure
  330.         processeur proco;
  331.  
  332.         // copy the content of each properties in the structure
  333.         strcpy(proco.marque, array[0]);
  334.         strcpy(proco.modele, array[1]);
  335.         strcpy(proco.socket, array[2]);
  336.         strcpy(proco.frequence, array[3]);
  337.         strcpy(proco.nbemplacementRam, array[4]);
  338.         strcpy(proco.uniqueSellingPoint, array[5]);
  339.         strcpy(proco.fiab, array[6]);
  340.         strcpy(proco.restriction, array[7]);
  341.         strcpy(proco.prix, array[8]);
  342.         strcpy(proco.indiceDePerf, array[9]);
  343.         strcpy(proco.consoElec, array[10]);
  344.         strcpy(proco.coefOverclock, array[11]);
  345.  
  346.         // add this structure in the array defined previousment
  347.         proco_array[cpt++] = proco;
  348.     }
  349.     fclose(fichier);
  350. }
  351.  
  352. void ouverture_Ecran(caracEcran ecran_array[9]){
  353.     FILE* fichier = NULL;
  354.     char caractere[TAILLE_MAX];
  355.  
  356.     fichier = fopen("ECRAN.csv", "r");
  357.     if(fichier != NULL)
  358.     {
  359.     }
  360.     else
  361.     {
  362.         printf("impossible d'ouvrir le fichier");
  363.     }
  364.  
  365.     // Define our proco array to store all lines in CSV file
  366.  
  367.     int cpt = 0;
  368.     // get the whole line for each
  369.     while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
  370.     {
  371.         // Get all the strings delimited by a ';'
  372.         char ** array = str_split(caractere, ';');
  373.  
  374.         // Define a new structure
  375.         caracEcran ecran;
  376.  
  377.         // copy the content of each properties in the structure
  378.         strcpy(ecran.marque, array[0]);
  379.         strcpy(ecran.modele, array[1]);
  380.         strcpy(ecran.taille, array[2]);
  381.         strcpy(ecran.resolMax, array[3]);
  382.         strcpy(ecran.typePort, array[4]);
  383.         strcpy(ecran.uniqueSellingPoint, array[5]);
  384.         strcpy(ecran.fiab, array[6]);
  385.         strcpy(ecran.restriction, array[7]);
  386.         strcpy(ecran.prix, array[8]);
  387.         strcpy(ecran.indiceDePerf, array[9]);
  388.         strcpy(ecran.consoElec, array[10]);
  389.  
  390.  
  391.         // add this structure in the array defined previousment
  392.         ecran_array[cpt++] = ecran;
  393.     }
  394.  
  395.     fclose(fichier);
  396. }
  397.  
  398. void ouverture_ram(Ram ram_array[11]){
  399.     FILE* fichier = NULL;
  400.     char caractere[TAILLE_MAX];
  401.  
  402.     fichier = fopen("RAM.csv", "r");
  403.     if(fichier != NULL)
  404.     {
  405.     }
  406.     else
  407.     {
  408.         printf("impossible d'ouvrir le fichier");
  409.     }
  410.  
  411.     // Define our ram array to store all lines in CSV file
  412.  
  413.     int cpt = 0;
  414.     // get the whole line for each
  415.     while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
  416.     {
  417.         // Get all the strings delimited by a ';'
  418.         char ** array = str_split(caractere, ';');
  419.  
  420.         // Define a new structure
  421.         Ram ram;
  422.  
  423.         // copy the content of each properties in the structure
  424.         strcpy(ram.marque, array[0]);
  425.         strcpy(ram.modele, array[1]);
  426.         strcpy(ram.ver_ram, array[2]);
  427.         strcpy(ram.freq, array[3]);
  428.         strcpy(ram.ram_mod, array[4]);
  429.         strcpy(ram.fiab, array[5]);
  430.         strcpy(ram.restrict, array[6]);
  431.         strcpy(ram.prix, array[7]);
  432.         strcpy(ram.perform, array[8]);
  433.         strcpy(ram.cons_elec, array[9]);
  434.         strcpy(ram.overclock, array[10]);
  435.  
  436.         // add this structure in the array defined previousment
  437.         ram_array[cpt++] = ram;
  438.     }
  439.  
  440.     fclose(fichier);
  441. }
  442.  
  443. void ouverture_soft(Soft soft_array[6]){
  444.     FILE* fichier = NULL;
  445.     char caractere[TAILLE_MAX];
  446.  
  447.     fichier = fopen("SOFT.csv", "r");
  448.     if(fichier != NULL)
  449.     {
  450.     }
  451.     else
  452.     {
  453.         printf("impossible d'ouvrir le fichier");
  454.     }
  455.  
  456.     // Define our soft array to store all lines in CSV file
  457.  
  458.     int cpt = 0;
  459.     // get the whole line for each
  460.     while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
  461.     {
  462.         // Get all the strings delimited by a ';'
  463.         char ** array = str_split(caractere, ';');
  464.  
  465.         // Define a new structure
  466.         Soft soft;
  467.  
  468.         // copy the content of each properties in the structure
  469.         strcpy(soft.soft, array[0]);
  470.         strcpy(soft.ram, array[1]);
  471.         strcpy(soft.rom, array[2]);
  472.         strcpy(soft.puis_graph, array[3]);
  473.         strcpy(soft.puis_proc, array[4]);
  474.         strcpy(soft.usp, array[5]);
  475.         // add this structure in the array defined previousment
  476.         soft_array[cpt++] = soft;
  477.     }
  478.  
  479.     fclose(fichier);
  480. }
  481.  
  482. void affichage_ram(){
  483.         printf("1: Marque\n");
  484.         printf("2: Modele\n");
  485.         printf("3: Version de la RAM\n");
  486.         printf("4: Frequence\n");
  487.         printf("5: Quantite par module\n");
  488.         printf("6: Taux de fiabilite du materiel\n");
  489.         printf("7: Prix\n");
  490.         printf("8: Indice de performance\n");
  491.         printf("9: Consommation electrique\n");
  492.         printf("10: Coefficient d'overclocking\n");
  493. }
  494.  
  495. void affichage_graphics(){
  496.     printf("1: Marque\n");
  497.     printf("2: Modele\n");
  498.     printf("3: Nombre de ports VGA\n");
  499.     printf("4: Nombre de ports DVI\n");
  500.     printf("5: Nombre de ports HDMI\n");
  501.     printf("6: Nombre de ports MINIDP\n");
  502.     printf("7: Unique Selling Points\n");
  503.     printf("8: Taux de fiabilite\n");
  504.     printf("9: Restrictions d'usage\n");
  505.     printf("10: Prix\n");
  506.     printf("11: Indice de performance\n");
  507.     printf("12: Consommation electrique\n");
  508.     printf("13: Coefficient d'overclocking\n\n");
  509.     printf("0: Quitter la selection\n");
  510. }
  511.  
  512. void affichage_motherboard(){
  513.     printf("1: Marque\n");
  514.     printf("2: Modele\n");
  515.     printf("3: Type de socket processeur\n");
  516.     printf("4: Nombre de socket\n");
  517.     printf("5: Nombre d'emplacement de RAM\n");
  518.     printf("6: Version de la RAM\n");
  519.     printf("7: Nombre de ports PCIE 16\n");
  520.     printf("8: Nombre de ports IDE\n");
  521.     printf("9: Nombre de ports SATA\n");
  522.     printf("10: Nombre de ports USB\n");
  523.     printf("11: Nombre de ports VGA\n");
  524.     printf("12: Nombre de ports DVI\n");
  525.     printf("13: Nombre de ports reseau\n");
  526.     printf("14: Format de la carte\n");
  527.     printf("15: Unique Selling Points\n");
  528.     printf("16: Taux de fiabilite\n");
  529.     printf("17: Restrictions d'usage\n");
  530.     printf("18: Prix");
  531.     printf("19: Consommation electrique\n");
  532.     printf("20: Coefficient d'overclocking\n\n");
  533.     printf("0: Quitter la selection\n");
  534. }
  535.  
  536. void affichage_ecran(){
  537.     printf("1: Marque\n");
  538.     printf("2: Modele\n");
  539.     printf("3: Taille(en pouces)\n");
  540.     printf("4: Resolution maximale\n");
  541.     printf("5: Type de port\n");
  542.     printf("6: Unique Selling Points\n");
  543.     printf("7: Taux de fiabilite\n");
  544.     printf("8: Restrictions d'usage\n");
  545.     printf("9: Prix\n");
  546.     printf("10: Indice de performance\n");
  547.     printf("11: Consommation electrique\n\n");
  548.     printf("0: Quitter la selection\n");
  549. }
  550.  
  551. void affichage_hdd(){
  552.     printf("1: Marque\n");
  553.     printf("2: Modele\n");
  554.     printf("3: Espace disque (en Go)\n");
  555.     printf("4: Type de port\n");
  556.     printf("5: Unique Selling Points\n");
  557.     printf("6: Taux de fiabilite\n");
  558.     printf("7: Restrictions d'usage\n");
  559.     printf("8: Prix\n");
  560.     printf("9: Indice de performance\n");
  561.     printf("10: Consommation electrique\n\n");
  562.     printf("0: Quitter la selection\n");
  563. }
  564.  
  565. void affichage_proco(){
  566.     printf("1: Marque\n");
  567.     printf("2: Modele\n");
  568.     printf("3: Type de socket processeur\n");
  569.     printf("4: Frequence\n");
  570.     printf("5: Nombre d'emplacement de RAM supporte\n");
  571.     printf("6: Unique Selling Points\n");
  572.     printf("7: Taux de fiabilite\n");
  573.     printf("8: Restrictions d'usage\n");
  574.     printf("9: Prix\n");
  575.     printf("10: Indice de performance\n");
  576.     printf("11: Consommation electrique\n");
  577.     printf("12: Codefficient d'overclocking\n\n");
  578.     printf("0: Quitter la selection\n");
  579. }
  580.  
  581. void affichage_soft(){
  582.     printf("1: Nom du logiciel\n");
  583.     printf("2: RAM necessaire\n");
  584.     printf("3: Espace disque necessaire\n");
  585.     printf("4: Puissance graphique necessaire\n");
  586.     printf("5: Puissance processeur necessaire\n");
  587.     printf("6: Unique Selling Points\n\n");
  588.     printf("0: Quitter la selection\n");
  589. }
  590.  
  591. void demande_proco(processeur proco_array[11], processeur* proco_recherche){
  592.     int rep;
  593.     int i;
  594.     int j;
  595.     do
  596.     {
  597.         j=0;
  598.         system("cls");
  599.         printf("Quel parametres souhaitez vous parametrer?\n");
  600.         affichage_proco();
  601.         scanf("%d", &rep);
  602.         if(rep==1)
  603.         {
  604.             printf("Saisir la marque souhaitee\n");
  605.             scanf("%s", proco_recherche->marque);
  606.             for(i=0; i<8; i++)
  607.             {
  608.                 if (strcmp(proco_recherche->marque, proco_array[i].marque)==0)
  609.                 {
  610.                     j++;
  611.                 }
  612.             }
  613.         }
  614.         if(rep==2)
  615.         {
  616.             printf("Saisir le modele souhaite\n");
  617.             scanf("%s", proco_recherche->modele);
  618.             for(i=0; i<8; i++)
  619.             {
  620.                 if (strcmp(proco_recherche->modele, proco_array[i].modele)==0)
  621.                 {
  622.                     j++;
  623.                 }
  624.             }
  625.         }
  626.         if(rep==3)
  627.         {
  628.             printf("Saisir le type de socket souhaite\n");
  629.             scanf("%s", proco_recherche->socket);
  630.             for(i=0; i<8; i++)
  631.             {
  632.                 if (strcmp(proco_recherche->socket, proco_array[i].socket)==0)
  633.                 {
  634.                     j++;
  635.                 }
  636.             }
  637.         }
  638.         if(rep==4)
  639.         {
  640.             printf("Saisir la frequence souhaitee\n");
  641.             scanf("%s", proco_recherche->frequence);
  642.             for(i=0; i<8; i++)
  643.             {
  644.                 if (strcmp(proco_recherche->frequence, proco_array[i].frequence)==0)
  645.                 {
  646.                     j++;
  647.                 }
  648.             }
  649.         }
  650.         if(rep==5)
  651.         {
  652.             printf("Saisir le nombre d'emplacement RAM souhaite\n");
  653.             scanf("%s", proco_recherche->nbemplacementRam);
  654.             for(i=0; i<8; i++)
  655.             {
  656.                 if (strcmp(proco_recherche->nbemplacementRam, proco_array[i].nbemplacementRam)==0)
  657.                 {
  658.                     j++;
  659.                 }
  660.             }
  661.         }
  662.         if(rep==6)
  663.         {
  664.             printf("Saisir l'USP souhaite\n");
  665.             scanf("%s", proco_recherche->uniqueSellingPoint);
  666.             for(i=0; i<8; i++)
  667.             {
  668.                 if (strcmp(proco_recherche->uniqueSellingPoint, proco_array[i].uniqueSellingPoint)==0)
  669.                 {
  670.                     j++;
  671.                 }
  672.             }
  673.         }
  674.         if(rep==7)
  675.         {
  676.             printf("Saisir le taux de fiabilite souhaite\n");
  677.             scanf("%s", proco_recherche->fiab);
  678.             for(i=0; i<8; i++)
  679.             {
  680.                 if (strcmp(proco_recherche->fiab, proco_array[i].fiab)==0)
  681.                 {
  682.                     j++;
  683.                 }
  684.             }
  685.         }
  686.         if(rep==8)
  687.         {
  688.             printf("Saisir les restrictions d'usage souhaitees\n");
  689.             scanf("%s", proco_recherche->restriction);
  690.             for(i=0; i<8; i++)
  691.             {
  692.                 if (strcmp(proco_recherche->restriction, proco_array[i].restriction)==0)
  693.                 {
  694.                     j++;
  695.                 }
  696.             }
  697.         }
  698.         if(rep==9)
  699.         {
  700.             printf("Saisir le prix souhaite\n");
  701.             scanf("%s", proco_recherche->prix);
  702.             for(i=0; i<8; i++)
  703.             {
  704.                 if (strcmp(proco_recherche->prix, proco_array[i].prix)==0)
  705.                 {
  706.                     j++;
  707.                 }
  708.             }
  709.         }
  710.         if(rep==10)
  711.         {
  712.             printf("Saisir la consommation electrique souhaitee\n");
  713.             scanf("%s", proco_recherche->consoElec);
  714.             for(i=0; i<8; i++)
  715.             {
  716.                 if (strcmp(proco_recherche->consoElec, proco_array[i].consoElec)==0)
  717.                 {
  718.                     j++;
  719.                 }
  720.             }
  721.         }
  722.         if(rep==11)
  723.         {
  724.             printf("Saisir le coefficient d'overclocking souhaite\n");
  725.             scanf("%s", proco_recherche->coefOverclock);
  726.             for(i=0; i<8; i++)
  727.             {
  728.                 if (strcmp(proco_recherche->coefOverclock, proco_array[i].coefOverclock)==0)
  729.                 {
  730.                     j++;
  731.                 }
  732.             }
  733.         }
  734.         printf("Nous avons trouvé %d fois votre config \n", j);
  735.     }
  736.     while (rep!=0);
  737. }
  738.  
  739. void demande_ram(Ram ram_array[11], Ram* ram_recherche){
  740.     int rep;
  741.     int i,j;
  742.     do
  743.     {
  744.         system("cls");
  745.         printf("Quel parametres souhaitez vous parametrer?\n");
  746.         affichage_ram();
  747.         j=0;
  748.         scanf("%d", &rep);
  749.         if(rep==1)
  750.         {
  751.             printf("Saisir la marque souhaitee");
  752.             scanf("%s", ram_recherche->marque);
  753.             for(i=0; i<18; i++)
  754.             {
  755.                 if (strcmp(ram_recherche->marque, ram_array[i].marque)==0)
  756.                 {
  757.                    j++;
  758.                 }
  759.             }
  760.             printf("Nous avons trouvé %d fois votre config \n", j);
  761.             system("PAUSE");
  762.         }
  763.         if(rep==2)
  764.         {
  765.             printf("Saisir le modele souhaite");
  766.             scanf("%s", ram_recherche->modele);
  767.             for(i=0; i<18; i++)
  768.             {
  769.                 if (strcmp(ram_recherche->modele, ram_array[i].modele)==0)
  770.                 {
  771.                     j++;
  772.                 }
  773.             }
  774.             printf("Nous avons trouvé %d fois votre config \n", j);
  775.             system("PAUSE");
  776.         }
  777.         if(rep==3)
  778.         {
  779.             printf("Saisir la version de la ram");
  780.             scanf("%s", ram_recherche->ver_ram);
  781.             for(i=0; i<18; i++)
  782.             {
  783.                 if (strcmp(ram_recherche->ver_ram, ram_array[i].ver_ram)==0)
  784.                 {
  785.                     j++;
  786.                 }
  787.             }
  788.             printf("Nous avons trouvé %d fois votre config \n", j);
  789.             system("PAUSE");
  790.         }
  791.         if(rep==4)
  792.         {
  793.             printf("Saisir la frequence");
  794.             scanf("%s", ram_recherche->freq);
  795.             for(i=0; i<18; i++)
  796.             {
  797.                 if (strcmp(ram_recherche->freq, ram_array[i].freq)==0)
  798.                 {
  799.                     j++;
  800.                 }
  801.             }
  802.             printf("Nous avons trouvé %d fois votre config \n", j);
  803.             system("PAUSE");
  804.         }
  805.         if(rep==5)
  806.         {
  807.             printf("Saisir la quantité par module");
  808.             scanf("%s", ram_recherche->ram_mod);
  809.             for(i=0; i<18; i++)
  810.             {
  811.                 if (strcmp(ram_recherche->ram_mod, ram_array[i].ver_ram)==0)
  812.                 {
  813.                      j++;
  814.                 }
  815.             }
  816.             printf("Nous avons trouvé %d fois votre config \n", j);
  817.             system("PAUSE");
  818.         }
  819.         if(rep==6)
  820.         {
  821.             printf("Saisir le taux de fiabilité");
  822.             scanf("%s", ram_recherche->fiab);
  823.             for(i=0; i<18; i++)
  824.             {
  825.                 if (strcmp(ram_recherche->fiab, ram_array[i].ver_ram)==0)
  826.                 {
  827.                      j++;
  828.                 }
  829.             }
  830.             printf("Nous avons trouvé %d fois votre config \n", j);
  831.             system("PAUSE");
  832.         }
  833.         if(rep==7)
  834.         {
  835.             printf("Saisir le prix");
  836.             scanf("%s", ram_recherche->prix);
  837.             for(i=0; i<18; i++)
  838.             {
  839.                 if (strcmp(ram_recherche->prix, ram_array[i].ver_ram)==0)
  840.                 {
  841.                      j++;
  842.                 }
  843.             }
  844.             printf("Nous avons trouvé %d fois votre config \n", j);
  845.             system("PAUSE");
  846.         }
  847.         if(rep==8)
  848.         {
  849.             printf("Saisir l'indice de performance");
  850.             scanf("%s", ram_recherche->perform);
  851.             for(i=0; i<18; i++)
  852.             {
  853.                 if (strcmp(ram_recherche->perform, ram_array[i].ver_ram)==0)
  854.                 {
  855.                      j++;
  856.                 }
  857.             }
  858.             printf("Nous avons trouvé %d fois votre config \n", j);
  859.             system("PAUSE");
  860.         }
  861.         if(rep==9)
  862.         {
  863.             printf("Saisir la consommation electrique");
  864.             scanf("%s", ram_recherche->cons_elec);
  865.             for(i=0; i<18; i++)
  866.             {
  867.                 if (strcmp(ram_recherche->cons_elec, ram_array[i].ver_ram)==0)
  868.                 {
  869.                      j++;
  870.                 }
  871.             }
  872.             printf("Nous avons trouvé %d fois votre config \n", j);
  873.             system("PAUSE");
  874.         }
  875.         if(rep==10)
  876.         {
  877.             printf("Saisir le coefficient d'overclocking");
  878.             scanf("%s", ram_recherche->overclock);
  879.             for(i=0; i<18; i++)
  880.             {
  881.                 if (strcmp(ram_recherche->overclock, ram_array[i].ver_ram)==0)
  882.                 {
  883.                     j++;
  884.                 }
  885.             }
  886.             printf("Nous avons trouvé %d fois votre config \n", j);
  887.             system("PAUSE");
  888.         }
  889.     }while(rep!=0);
  890. }
  891.  
  892. void demande_graphics(Graphics graphics_array[12], Graphics* graphics_recherche){
  893.     int rep;
  894.     int i;
  895.     int j;
  896.     do
  897.     {
  898.         j=0;
  899.         system("cls");
  900.         printf("Quel parametres souhaitez vous parametrer?\n");
  901.         affichage_graphics();
  902.         scanf("%d", &rep);
  903.         if(rep==1)
  904.         {
  905.             printf("Saisir la marque souhaitee\n");
  906.             scanf("%s", graphics_recherche->marque);
  907.             for(i=0; i<6; i++)
  908.             {
  909.                 if (strcmp(graphics_recherche->marque, graphics_array[i].marque)==0)
  910.                 {
  911.                     j++;
  912.                 }
  913.             }
  914.             printf("Nous avons trouvé %d fois votre config \n", j);
  915.         }
  916.         if(rep==2)
  917.         {
  918.             printf("Saisir le modele souhaite\n");
  919.             scanf("%s", graphics_recherche->modele);
  920.             for(i=0; i<6; i++)
  921.             {
  922.                 if (strcmp(graphics_recherche->modele, graphics_array[i].modele)==0)
  923.                 {
  924.                     j++;
  925.                 }
  926.             }
  927.             printf("Nous avons trouvé %d fois votre config \n", j);
  928.         }
  929.         if(rep==3)
  930.         {
  931.             printf("Saisir le nombre de ports VGA\n");
  932.             scanf("%s", graphics_recherche->nbr_vga);
  933.             for(i=0; i<6; i++)
  934.             {
  935.                 if (strcmp(graphics_recherche->nbr_vga, graphics_array[i].nbr_vga)==0)
  936.                 {
  937.                     j++;
  938.                 }
  939.             }
  940.             printf("Nous avons trouvé %d fois votre config \n", j);
  941.         }
  942.         if(rep==4)
  943.         {
  944.             printf("Saisir le nombre de ports DVI\n");
  945.             scanf("%s", graphics_recherche->nbr_dvi);
  946.             for(i=0; i<6; i++)
  947.             {
  948.                 if (strcmp(graphics_recherche->nbr_dvi, graphics_array[i].nbr_dvi)==0)
  949.                 {
  950.                     j++;
  951.                 }
  952.             }
  953.             printf("Nous avons trouvé %d fois votre config \n", j);
  954.         }
  955.         if(rep==5)
  956.         {
  957.             printf("Saisir le nombre de ports HDMI\n");
  958.             scanf("%s", graphics_recherche->nbr_hdmi);
  959.             for(i=0; i<6; i++)
  960.             {
  961.                 if (strcmp(graphics_recherche->nbr_hdmi, graphics_array[i].nbr_hdmi)==0)
  962.                 {
  963.                     j++;
  964.                 }
  965.             }
  966.             printf("Nous avons trouvé %d fois votre config \n", j);
  967.         }
  968.         if(rep==6)
  969.         {
  970.             printf("Saisir le nombre de ports MINIDP\n");
  971.             scanf("%s", graphics_recherche->nbr_minidp);
  972.             for(i=0; i<6; i++)
  973.             {
  974.                 if (strcmp(graphics_recherche->nbr_minidp, graphics_array[i].nbr_minidp)==0)
  975.                 {
  976.                     j++;
  977.                 }
  978.             }
  979.             printf("Nous avons trouvé %d fois votre config \n", j);
  980.         }
  981.         if(rep==7)
  982.         {
  983.             printf("Saisir l'USP\n");
  984.             scanf("%s", graphics_recherche->usp);
  985.             for(i=0; i<6; i++)
  986.             {
  987.                 if (strcmp(graphics_recherche->usp, graphics_array[i].usp)==0)
  988.                 {
  989.                     j++;
  990.                 }
  991.             }
  992.             printf("Nous avons trouvé %d fois votre config \n", j);
  993.         }
  994.         if(rep==8)
  995.         {
  996.             printf("Saisir les restrictions d'usage\n");
  997.             scanf("%s", graphics_recherche->restrict);
  998.             for(i=0; i<6; i++)
  999.             {
  1000.                 if (strcmp(graphics_recherche->restrict, graphics_array[i].restrict)==0)
  1001.                 {
  1002.                     j++;
  1003.                 }
  1004.             }
  1005.             printf("Nous avons trouvé %d fois votre config \n", j);
  1006.         }
  1007.         if(rep==9)
  1008.         {
  1009.             printf("Saisir le prix\n");
  1010.             scanf("%s", graphics_recherche->prix);
  1011.             for(i=0; i<6; i++)
  1012.             {
  1013.                 if (strcmp(graphics_recherche->prix, graphics_array[i].prix)==0)
  1014.                 {
  1015.                     j++;
  1016.                 }
  1017.             }
  1018.             printf("Nous avons trouvé %d fois votre config \n", j);
  1019.         }
  1020.         if(rep==10)
  1021.         {
  1022.             printf("Saisir l'indice de performance\n");
  1023.             scanf("%s", graphics_recherche->perf);
  1024.             for(i=0; i<6; i++)
  1025.             {
  1026.                 if (strcmp(graphics_recherche->perf, graphics_array[i].perf)==0)
  1027.                 {
  1028.                     j++;
  1029.                 }
  1030.             }
  1031.             printf("Nous avons trouvé %d fois votre config\n", j);
  1032.         }
  1033.         if(rep==11)
  1034.         {
  1035.             printf("Saisir la consommation electrique\n");
  1036.             scanf("%s", graphics_recherche->conso_elec);
  1037.             for(i=0; i<6; i++)
  1038.             {
  1039.                 if (strcmp(graphics_recherche->conso_elec, graphics_array[i].conso_elec)==0)
  1040.                 {
  1041.                     j++;
  1042.                 }
  1043.             }
  1044.         }
  1045.         printf("Nous avons trouvé %d fois votre config\n", j);
  1046.         if(rep==12)
  1047.         {
  1048.             printf("Saisir le coefficient d'overclocking\n");
  1049.             scanf("%s", graphics_recherche->overclock);
  1050.             for(i=0; i<6; i++)
  1051.             {
  1052.                 if (strcmp(graphics_recherche->overclock, graphics_array[i].overclock)==0)
  1053.                 {
  1054.                     j++;
  1055.                 }
  1056.             }
  1057.         }
  1058.         printf("Nous avons trouvé %d fois votre config\n", j);
  1059.     }
  1060.     while(rep!=0);
  1061. }
  1062.  
  1063. void demande_motherboard(Motherboard motherboard_array[19], Motherboard* motherboard_recherche){
  1064.     int rep;
  1065.     int i;
  1066.     int j;
  1067.     do
  1068.     {
  1069.         j=0;
  1070.         system("cls");
  1071.         printf("Quel parametres souhaitez vous parametrer?\n");
  1072.         affichage_motherboard();
  1073.         scanf("%d", &rep);
  1074.         if(rep==1)
  1075.         {
  1076.             printf("Saisir la marque souhaitee\n");
  1077.             scanf("%s", motherboard_recherche->marque);
  1078.             for(i=0; i<10; i++)
  1079.             {
  1080.                 if (strcmp(motherboard_recherche->marque, motherboard_array[i].marque)==0)
  1081.                 {
  1082.                     j++;
  1083.                 }
  1084.             }
  1085.         }
  1086.         if(rep==2)
  1087.         {
  1088.             printf("Saisir le modele souhaite\n");
  1089.             scanf("%s", motherboard_recherche->modele);
  1090.             for(i=0; i<10; i++)
  1091.             {
  1092.                 if (strcmp(motherboard_recherche->modele, motherboard_array[i].modele)==0)
  1093.                 {
  1094.                     j++;
  1095.                 }
  1096.             }
  1097.         }
  1098.         if(rep==3)
  1099.         {
  1100.             printf("Saisir le type de socket processeur souhaite\n");
  1101.             scanf("%s", motherboard_recherche->socket_proc);
  1102.             for(i=0; i<10; i++)
  1103.             {
  1104.                 if (strcmp(motherboard_recherche->socket_proc, motherboard_array[i].socket_proc)==0)
  1105.                 {
  1106.                     j++;
  1107.                 }
  1108.             }
  1109.         }
  1110.         if(rep==4)
  1111.         {
  1112.             printf("Saisir le nombre de socket souhaite\n");
  1113.             scanf("%s", motherboard_recherche->nbr_socket);
  1114.             for(i=0; i<10; i++)
  1115.             {
  1116.                 if (strcmp(motherboard_recherche->nbr_socket, motherboard_array[i].nbr_socket)==0)
  1117.                 {
  1118.                     j++;
  1119.                 }
  1120.             }
  1121.         }
  1122.         if(rep==5)
  1123.         {
  1124.             printf("Saisir le nombre d'emplacement RAM souhaite\n");
  1125.             scanf("%s", motherboard_recherche->nbr_ram);
  1126.             for(i=0; i<10; i++)
  1127.             {
  1128.                 if (strcmp(motherboard_recherche->nbr_ram, motherboard_array[i].nbr_ram)==0)
  1129.                 {
  1130.                     j++;
  1131.                 }
  1132.             }
  1133.         }
  1134.         if(rep==5)
  1135.         {
  1136.             printf("Saisir la version de la RAM souhaitee\n");
  1137.             scanf("%s", motherboard_recherche->ver_ram);
  1138.             for(i=0; i<10; i++)
  1139.             {
  1140.                 if (strcmp(motherboard_recherche->ver_ram, motherboard_array[i].ver_ram)==0)
  1141.                 {
  1142.                     j++;
  1143.                 }
  1144.             }
  1145.         }
  1146.         if(rep==7)
  1147.         {
  1148.             printf("Saisir le nombre de ports PCIE 16 souhaite\n");
  1149.             scanf("%s", motherboard_recherche->nbr_pci);
  1150.             for(i=0; i<10; i++)
  1151.             {
  1152.                 if (strcmp(motherboard_recherche->nbr_pci, motherboard_array[i].nbr_pci)==0)
  1153.                 {
  1154.                     j++;
  1155.                 }
  1156.             }
  1157.         }
  1158.         if(rep==8)
  1159.         {
  1160.             printf("Saisir le nombre de ports IDE souhaite\n");
  1161.             scanf("%s", motherboard_recherche->nbr_ide);
  1162.             for(i=0; i<10; i++)
  1163.             {
  1164.                 if (strcmp(motherboard_recherche->nbr_ide, motherboard_array[i].nbr_ide)==0)
  1165.                 {
  1166.                     j++;
  1167.                 }
  1168.             }
  1169.         }
  1170.         if(rep==9)
  1171.         {
  1172.             printf("Saisir le nombre de ports SATA souhaite\n");
  1173.             scanf("%s", motherboard_recherche->nbr_sata);
  1174.             for(i=0; i<10; i++)
  1175.             {
  1176.                 if (strcmp(motherboard_recherche->nbr_sata, motherboard_array[i].nbr_sata)==0)
  1177.                 {
  1178.                     j++;
  1179.                 }
  1180.             }
  1181.         }
  1182.         if(rep==10)
  1183.         {
  1184.             printf("Saisir le nombre de ports USB souhaite\n");
  1185.             scanf("%s", motherboard_recherche->nbr_usb);
  1186.             for(i=0; i<10; i++)
  1187.             {
  1188.                 if (strcmp(motherboard_recherche->nbr_usb, motherboard_array[i].nbr_usb)==0)
  1189.                 {
  1190.                     j++;
  1191.                 }
  1192.             }
  1193.         }
  1194.         if(rep==11)
  1195.         {
  1196.             printf("Saisir le nombre de ports VGA souhaite\n");
  1197.             scanf("%s", motherboard_recherche->nbr_vga);
  1198.             for(i=0; i<10; i++)
  1199.             {
  1200.                 if (strcmp(motherboard_recherche->nbr_vga, motherboard_array[i].nbr_vga)==0)
  1201.                 {
  1202.                     j++;
  1203.                 }
  1204.             }
  1205.         }
  1206.         if(rep==12)
  1207.         {
  1208.             printf("Saisir le nombre de ports DVI souhaite\n");
  1209.             scanf("%s", motherboard_recherche->nbr_dvi);
  1210.             for(i=0; i<10; i++)
  1211.             {
  1212.                 if (strcmp(motherboard_recherche->nbr_dvi, motherboard_array[i].nbr_dvi)==0)
  1213.                 {
  1214.                     j++;
  1215.                 }
  1216.             }
  1217.         }
  1218.         if(rep==13)
  1219.         {
  1220.             printf("Saisir le nombre de ports reseau souhaite\n");
  1221.             scanf("%s", motherboard_recherche->nbr_reseau);
  1222.             for(i=0; i<10; i++)
  1223.             {
  1224.                 if (strcmp(motherboard_recherche->nbr_dvi, motherboard_array[i].nbr_dvi)==0)
  1225.                 {
  1226.                     j++;
  1227.                 }
  1228.             }
  1229.         }
  1230.         if(rep==14)
  1231.         {
  1232.             printf("Saisir le format souhaite\n");
  1233.             scanf("%s", motherboard_recherche->format);
  1234.             for(i=0; i<10; i++)
  1235.             {
  1236.                 if (strcmp(motherboard_recherche->format, motherboard_array[i].format)==0)
  1237.                 {
  1238.                     j++;
  1239.                 }
  1240.             }
  1241.         }
  1242.         if(rep==15)
  1243.         {
  1244.             printf("Saisir l'USP souhaite\n");
  1245.             scanf("%s", motherboard_recherche->usp);
  1246.             for(i=0; i<10; i++)
  1247.             {
  1248.                 if (strcmp(motherboard_recherche->usp, motherboard_array[i].usp)==0)
  1249.                 {
  1250.                     j++;
  1251.                 }
  1252.             }
  1253.         }
  1254.         if(rep==16)
  1255.         {
  1256.             printf("Saisir le taux de fiabilité souhaite\n");
  1257.             scanf("%s", motherboard_recherche->fiab);
  1258.             for(i=0; i<10; i++)
  1259.             {
  1260.                 if (strcmp(motherboard_recherche->fiab, motherboard_array[i].fiab)==0)
  1261.                 {
  1262.                     j++;
  1263.                 }
  1264.             }
  1265.         }
  1266.         if(rep==17)
  1267.         {
  1268.             printf("Saisir les restrictions d'usage souhaitees\n");
  1269.             scanf("%s", motherboard_recherche->restrict);
  1270.             for(i=0; i<10; i++)
  1271.             {
  1272.                 if (strcmp(motherboard_recherche->restrict, motherboard_array[i].restrict)==0)
  1273.                 {
  1274.                     j++;
  1275.                 }
  1276.             }
  1277.         }
  1278.         if(rep==18)
  1279.         {
  1280.             printf("Saisir le prix souhaite\n");
  1281.             scanf("%s", motherboard_recherche->prix);
  1282.             for(i=0; i<10; i++)
  1283.             {
  1284.                 if (strcmp(motherboard_recherche->prix, motherboard_array[i].prix)==0)
  1285.                 {
  1286.                     j++;
  1287.                 }
  1288.             }
  1289.         }
  1290.         if(rep==19)
  1291.         {
  1292.             printf("Saisir la consommation electrique souhaitee\n");
  1293.             scanf("%s", motherboard_recherche->conso_elec);
  1294.             for(i=0; i<10; i++)
  1295.             {
  1296.                 if (strcmp(motherboard_recherche->conso_elec, motherboard_array[i].conso_elec)==0)
  1297.                 {
  1298.                     j++;
  1299.                 }
  1300.             }
  1301.         }
  1302.         if(rep==20)
  1303.         {
  1304.             printf("Saisir le coefficient d'overclocking souhaite\n");
  1305.             scanf("%s", motherboard_recherche->overclock);
  1306.             for(i=0; i<10; i++)
  1307.             {
  1308.                 if (strcmp(motherboard_recherche->overclock, motherboard_array[i].overclock)==0)
  1309.                 {
  1310.                     j++;
  1311.                 }
  1312.             }
  1313.         }
  1314.     printf("Nous avons trouvé %d fois votre config \n", j);
  1315.     }
  1316.     while (i!=0);
  1317. }
  1318.  
  1319. void demande_hdd(Hdd hdd_array[9], Hdd* hdd_recherche){
  1320.     int rep;
  1321.     int i;
  1322.     int j;
  1323.     do
  1324.     {
  1325.         j=0;
  1326.         system("cls");
  1327.         printf("Quel parametres souhaitez vous parametrer?\n");
  1328.         affichage_hdd();
  1329.         scanf("%d", &rep);
  1330.         if(rep==1)
  1331.         {
  1332.             printf("Saisir la marque souhaitee\n");
  1333.             scanf("%s", hdd_recherche->marque);
  1334.             for(i=0; i<8; i++)
  1335.             {
  1336.                 if (strcmp(hdd_recherche->marque, hdd_array[i].marque)==0)
  1337.                 {
  1338.                     j++;
  1339.                 }
  1340.             }
  1341.         }
  1342.         if(rep==2)
  1343.         {
  1344.             printf("Saisir le modele souhaite\n");
  1345.             scanf("%s", hdd_recherche->modele);
  1346.             for(i=0; i<8; i++)
  1347.             {
  1348.                 if (strcmp(hdd_recherche->modele, hdd_array[i].modele)==0)
  1349.                 {
  1350.                     j++;
  1351.                 }
  1352.             }
  1353.         }
  1354.         if(rep==3)
  1355.         {
  1356.             printf("Saisir l'espace disque (en Go) souhaite\n");
  1357.             scanf("%s", hdd_recherche->capa);
  1358.             for(i=0; i<8; i++)
  1359.             {
  1360.                 if (strcmp(hdd_recherche->capa, hdd_array[i].capa)==0)
  1361.                 {
  1362.                     j++;
  1363.                 }
  1364.             }
  1365.         }
  1366.         if(rep==4)
  1367.         {
  1368.             printf("Saisir le type de port souhaite\n");
  1369.             scanf("%s", hdd_recherche->port);
  1370.             for(i=0; i<8; i++)
  1371.             {
  1372.                 if (strcmp(hdd_recherche->port, hdd_array[i].port)==0)
  1373.                 {
  1374.                     j++;
  1375.                 }
  1376.             }
  1377.         }
  1378.         if(rep==5)
  1379.         {
  1380.             printf("Saisir l'USP souhaite\n");
  1381.             scanf("%s", hdd_recherche->usp);
  1382.             for(i=0; i<8; i++)
  1383.             {
  1384.                 if (strcmp(hdd_recherche->usp, hdd_array[i].usp)==0)
  1385.                 {
  1386.                     j++;
  1387.                 }
  1388.             }
  1389.         }
  1390.         if(rep==6)
  1391.         {
  1392.             printf("Saisir le taux de fiabilite souhaite\n");
  1393.             scanf("%s", hdd_recherche->fiab);
  1394.             for(i=0; i<8; i++)
  1395.             {
  1396.                 if (strcmp(hdd_recherche->fiab, hdd_array[i].fiab)==0)
  1397.                 {
  1398.                     j++;
  1399.                 }
  1400.             }
  1401.         }
  1402.         if(rep==7)
  1403.         {
  1404.             printf("Saisir les restrictions d'usage souhaitees\n");
  1405.             scanf("%s", hdd_recherche->restrict);
  1406.             for(i=0; i<8; i++)
  1407.             {
  1408.                 if (strcmp(hdd_recherche->restrict, hdd_array[i].restrict)==0)
  1409.                 {
  1410.                     j++;
  1411.                 }
  1412.             }
  1413.         }
  1414.         if(rep==8)
  1415.         {
  1416.             printf("Saisir le prix souhaite\n");
  1417.             scanf("%s", hdd_recherche->prix);
  1418.             for(i=0; i<8; i++)
  1419.             {
  1420.                 if (strcmp(hdd_recherche->prix, hdd_array[i].prix)==0)
  1421.                 {
  1422.                     j++;
  1423.                 }
  1424.             }
  1425.         }
  1426.         if(rep==9)
  1427.         {
  1428.             printf("Saisir l'indice de performance souhaite\n");
  1429.             scanf("%s", hdd_recherche->perf);
  1430.             for(i=0; i<8; i++)
  1431.             {
  1432.                 if (strcmp(hdd_recherche->perf, hdd_array[i].perf)==0)
  1433.                 {
  1434.                     j++;
  1435.                 }
  1436.             }
  1437.         }
  1438.         if(rep==10)
  1439.         {
  1440.             printf("Saisir la consommation electrique souhaitee\n");
  1441.             scanf("%s", hdd_recherche->conso_elec);
  1442.             for(i=0; i<8; i++)
  1443.             {
  1444.                 if (strcmp(hdd_recherche->conso_elec, hdd_array[i].conso_elec)==0)
  1445.                 {
  1446.                     j++;
  1447.                 }
  1448.             }
  1449.         }
  1450.         printf("Nous avons trouvé %d fois votre config\n", j);
  1451.     }
  1452.     while (rep!=0);
  1453. }
  1454.  
  1455. void demande_ecran(caracEcran ecran_array[11], caracEcran* ecran_recherche){
  1456.     int rep;
  1457.     int i;
  1458.     int j;
  1459.     do
  1460.     {
  1461.         j=0;
  1462.         system("cls");
  1463.         printf("Quel parametres souhaitez vous parametrer?\n");
  1464.         affichage_ecran();
  1465.         scanf("%d", &rep);
  1466.         if(rep==1)
  1467.         {
  1468.             printf("Saisir la marque souhaitee\n");
  1469.             scanf("%s", ecran_recherche->marque);
  1470.             for(i=0; i<5; i++)
  1471.             {
  1472.                 if (strcmp(ecran_recherche->marque, ecran_array[i].marque)==0)
  1473.                 {
  1474.                     j++;
  1475.                 }
  1476.             }
  1477.         }
  1478.         if(rep==2)
  1479.         {
  1480.             printf("Saisir le modele souhaite\n");
  1481.             scanf("%s", ecran_recherche->modele);
  1482.             for(i=0; i<5; i++)
  1483.             {
  1484.                 if (strcmp(ecran_recherche->modele, ecran_array[i].modele)==0)
  1485.                 {
  1486.                     j++;
  1487.                 }
  1488.             }
  1489.         }
  1490.         if(rep==3)
  1491.         {
  1492.             printf("Saisir la taille en pouce souhaite\n");
  1493.             scanf("%s", ecran_recherche->taille);
  1494.             for(i=0; i<5; i++)
  1495.             {
  1496.                 if (strcmp(ecran_recherche->taille, ecran_array[i].taille)==0)
  1497.                 {
  1498.                     j++;
  1499.                 }
  1500.             }
  1501.         }
  1502.         if(rep==4)
  1503.         {
  1504.             printf("Saisir la resolution maximale souhaitée\n");
  1505.             scanf("%s", ecran_recherche->resolMax);
  1506.             for(i=0; i<5; i++)
  1507.             {
  1508.                 if (strcmp(ecran_recherche->resolMax, ecran_array[i].resolMax)==0)
  1509.                 {
  1510.                     j++;
  1511.                 }
  1512.             }
  1513.         }
  1514.         if(rep==5)
  1515.         {
  1516.             printf("Saisir le type de port souhaite\n");
  1517.             scanf("%s", ecran_recherche->typePort);
  1518.             for(i=0; i<5; i++)
  1519.             {
  1520.                 if (strcmp(ecran_recherche->typePort, ecran_array[i].typePort)==0)
  1521.                 {
  1522.                     j++;
  1523.                 }
  1524.             }
  1525.         }
  1526.         if(rep==6)
  1527.         {
  1528.             printf("Saisir le seul point de vente souhaite\n");
  1529.             scanf("%s", ecran_recherche->uniqueSellingPoint);
  1530.             for(i=0; i<5; i++)
  1531.             {
  1532.                 if (strcmp(ecran_recherche->uniqueSellingPoint, ecran_array[i].uniqueSellingPoint)==0)
  1533.                 {
  1534.                     j++;
  1535.                 }
  1536.             }
  1537.         }
  1538.         if(rep==7)
  1539.         {
  1540.             printf("Saisir le taux de fiabilité souhaitees\n");
  1541.             scanf("%s", ecran_recherche->fiab);
  1542.             for(i=0; i<5; i++)
  1543.             {
  1544.                 if (strcmp(ecran_recherche->fiab, ecran_array[i].fiab)==0)
  1545.                 {
  1546.                     j++;
  1547.                 }
  1548.             }
  1549.         }
  1550.         if(rep==8)
  1551.         {
  1552.             printf("Saisir les restrictions d'usage souhaites\n");
  1553.             scanf("%s", ecran_recherche->restriction);
  1554.             for(i=0; i<5; i++)
  1555.             {
  1556.                 if (strcmp(ecran_recherche->restriction, ecran_array[i].restriction)==0)
  1557.                 {
  1558.                     j++;
  1559.                 }
  1560.             }
  1561.         }
  1562.         if(rep==9)
  1563.         {
  1564.             printf("Saisir le prix souhaite\n");
  1565.             scanf("%s", ecran_recherche->prix);
  1566.             for(i=0; i<5; i++)
  1567.             {
  1568.                 if (strcmp(ecran_recherche->prix, ecran_array[i].prix)==0)
  1569.                 {
  1570.                     j++;
  1571.                 }
  1572.             }
  1573.         }
  1574.         if(rep==10)
  1575.         {
  1576.             printf("Saisir l'indice de performance souhaitee\n");
  1577.             scanf("%s", ecran_recherche->indiceDePerf);
  1578.             for(i=0; i<5; i++)
  1579.             {
  1580.                 if (strcmp(ecran_recherche->indiceDePerf, ecran_array[i].indiceDePerf)==0)
  1581.                 {
  1582.                     j++;
  1583.                 }
  1584.             }
  1585.         }
  1586.         if(rep==11)
  1587.         {
  1588.             printf("Saisir la consommation electrique souhaitee\n");
  1589.             scanf("%s", ecran_recherche->consoElec);
  1590.             for(i=0; i<5; i++)
  1591.             {
  1592.                 if (strcmp(ecran_recherche->consoElec, ecran_array[i].consoElec)==0)
  1593.                 {
  1594.                     j++;
  1595.                 }
  1596.             }
  1597.         }
  1598.         printf("Nous avons trouvé %d fois votre config\n", j);
  1599.     }
  1600.     while (rep!=0);
  1601. }
  1602.  
  1603. void demande_soft(Soft soft_array[9], Soft* soft_recherche){
  1604.     int rep;
  1605.     int i;
  1606.     int j;
  1607.     do
  1608.     {
  1609.         j=0;
  1610.         system("cls");
  1611.         printf("Quel parametres souhaitez vous parametrer?\n");
  1612.         affichage_soft();
  1613.         scanf("%d", &rep);
  1614.         if(rep==1)
  1615.         {
  1616.             printf("Saisir le logiciel souhaite\n");
  1617.             scanf("%s", soft_recherche->soft);
  1618.             for(i=0; i<6; i++)
  1619.             {
  1620.                 if (strcmp(soft_recherche->soft, soft_array[i].soft)==0)
  1621.                 {
  1622.                     j++;
  1623.                 }
  1624.             }
  1625.         }
  1626.         if(rep==2)
  1627.         {
  1628.             printf("Saisir la RAM necessaire souhaite\n");
  1629.             scanf("%s", soft_recherche->ram);
  1630.             for(i=0; i<6; i++)
  1631.             {
  1632.                 if (strcmp(soft_recherche->ram, soft_array[i].ram)==0)
  1633.                 {
  1634.                     j++;
  1635.                 }
  1636.             }
  1637.         }
  1638.         if(rep==3)
  1639.         {
  1640.             printf("Saisir l'espace disque (en Go)necessaire  souhaite\n");
  1641.             scanf("%s", soft_recherche->rom);
  1642.             for(i=0; i<6; i++)
  1643.             {
  1644.                 if (strcmp(soft_recherche->rom, soft_array[i].rom)==0)
  1645.                 {
  1646.                     j++;
  1647.                 }
  1648.             }
  1649.         }
  1650.         if(rep==4)
  1651.         {
  1652.             printf("Saisir la puissance graphique necessaire souhaitee\n");
  1653.             scanf("%s", soft_recherche->puis_graph);
  1654.             for(i=0; i<6; i++)
  1655.             {
  1656.                 if (strcmp(soft_recherche->puis_graph, soft_array[i].puis_graph)==0)
  1657.                 {
  1658.                     j++;
  1659.                 }
  1660.             }
  1661.         }
  1662.         if(rep==5)
  1663.         {
  1664.             printf("Saisir la puissance processeur necessaire souhaitee\n");
  1665.             scanf("%s", soft_recherche->puis_proc);
  1666.             for(i=0; i<6; i++)
  1667.             {
  1668.                 if (strcmp(soft_recherche->puis_proc, soft_array[i].puis_proc)==0)
  1669.                 {
  1670.                     j++;
  1671.                 }
  1672.             }
  1673.         }
  1674.         printf("Nous avons trouvé %d fois votre config\n", j);
  1675.     }
  1676.     while(rep!=0);
  1677. }
  1678.  
  1679. int main(){
  1680.     int i;
  1681.     processeur proco_array[11];
  1682.     Ram ram_array[11];
  1683.     Motherboard motherboard_array[19];
  1684.     Graphics graphic_array[12];
  1685.     Soft soft_array[9];
  1686.     caracEcran ecran_array[11];
  1687.     Hdd hdd_array[9];
  1688.  
  1689.     processeur proco_recherche;
  1690.     Ram ram_recherche;
  1691.     Motherboard motherboard_recherche;
  1692.     Graphics graphic_recherche;
  1693.     Soft soft_recherche;
  1694.     caracEcran ecran_recherche;
  1695.     Hdd hdd_recherche;
  1696.  
  1697.     int choix;
  1698.     printf("Bienvenue dans l'outil de comparaison de componsants informatiques\n");
  1699.     printf("Nous proposons de nombreux composants, faites donc vos choix et remplissez uniquement les categories si vous connaissez les references \n");
  1700.     printf("Veuillez choisir parmis la liste de composants suivants : \n");
  1701.     printf("1) Carte mere\n");
  1702.     printf("2) Processeur\n");
  1703.     printf("3) RAM\n");
  1704.     printf("4) Carte Graphique\n");
  1705.     printf("5) Disque Dur\n");
  1706.     printf("6) Ecran\n");
  1707.     printf("7) Logiciel\n");
  1708.     scanf("%d", &choix);
  1709.     switch(choix)
  1710.     {
  1711.     case 1:
  1712.         ouverture_motherboard(motherboard_array);
  1713.         demande_motherboard(motherboard_array, &motherboard_recherche);
  1714.         break;
  1715.     case 2:
  1716.         ouverture_proco(proco_array);
  1717.         demande_proco(proco_array, &proco_recherche);
  1718.         break;
  1719.     case 3:
  1720.         ouverture_ram(ram_array);
  1721.         demande_ram(ram_array, &ram_recherche);
  1722.         break;
  1723.     case 4:
  1724.         ouverture_graphics(graphic_array);
  1725.         demande_graphics(graphic_array, &graphic_recherche);
  1726.         break;
  1727.     case 5:
  1728.         ouverture_hdd(hdd_array);
  1729.         demande_hdd(hdd_array, &hdd_recherche);
  1730.         break;
  1731.     case 6:
  1732.         ouverture_Ecran(ecran_array);
  1733.         demande_ecran(ecran_array, &ecran_recherche);
  1734.         break;
  1735.     case 7:
  1736.         ouverture_soft(soft_array);
  1737.         demande_soft(soft_array, &soft_recherche);
  1738.         break;
  1739.     }
  1740.     return 0;
  1741. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement