Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define TAILLE_MAX 150
- typedef struct Motherboard{
- char marque[TAILLE_MAX];
- char modele[TAILLE_MAX];
- char socket_proc[TAILLE_MAX];
- char nbr_socket[TAILLE_MAX];
- char nbr_ram[TAILLE_MAX];
- char ver_ram[TAILLE_MAX];
- char nbr_pci[TAILLE_MAX];
- char nbr_ide[TAILLE_MAX];
- char nbr_sata[TAILLE_MAX];
- char nbr_usb[TAILLE_MAX];
- char nbr_vga[TAILLE_MAX];
- char nbr_dvi[TAILLE_MAX];
- char nbr_reseau[TAILLE_MAX];
- char format[TAILLE_MAX];
- char usp[TAILLE_MAX];
- char fiab[TAILLE_MAX];
- char restrict[TAILLE_MAX];
- char prix[TAILLE_MAX];
- char conso_elec[TAILLE_MAX];
- char overclock[TAILLE_MAX];
- }Motherboard;
- typedef struct Graphics{
- char marque[TAILLE_MAX];//Marque
- char modele[TAILLE_MAX];//Modèle
- char nbr_vga[TAILLE_MAX];//Nombre de ports VGA
- char nbr_dvi[TAILLE_MAX];//Nombre de ports DVI
- char nbr_hdmi[TAILLE_MAX];//Nombre de ports HDMI
- char nbr_minidp[TAILLE_MAX];//Nombre de ports MINIDP
- char usp[TAILLE_MAX];//Unique Selling Points
- char fiab[TAILLE_MAX];//Taux de fiabilité ( % de matériel vendu n'ayant pas montré de défaut)
- char restrict[TAILLE_MAX];//Restrictions d'usage
- char prix[TAILLE_MAX];//Prix
- char perf[TAILLE_MAX];//Indice de performance
- char conso_elec[TAILLE_MAX];//Consommation electrique
- char overclock[TAILLE_MAX];//Coefficient d'overclocking (impacte les performances et la consommation)
- }Graphics;
- typedef struct Hdd{
- char marque[TAILLE_MAX];//Marque
- char modele[TAILLE_MAX];//Modèle
- char capa[TAILLE_MAX];//Espace disque (en Go)
- char port[TAILLE_MAX];//Type de port
- char usp[TAILLE_MAX];//Unique Selling Points
- char fiab[TAILLE_MAX];//Taux de fiabilité ( % de matériel vendu n'ayant pas montré de défaut)
- char restrict[TAILLE_MAX];//Restrictions d'usage
- char prix[TAILLE_MAX];//Prix
- char perf[TAILLE_MAX];//Indice de performance
- char conso_elec[TAILLE_MAX];//Consommation electrique
- }Hdd;
- typedef struct processeur{
- char marque[TAILLE_MAX];
- char modele[TAILLE_MAX];
- char socket[TAILLE_MAX];
- char frequence[TAILLE_MAX];
- char restriction[TAILLE_MAX];
- char uniqueSellingPoint[TAILLE_MAX];
- char nbemplacementRam[TAILLE_MAX];
- char fiab[TAILLE_MAX];
- char prix[TAILLE_MAX];
- char indiceDePerf[TAILLE_MAX];
- char consoElec[TAILLE_MAX];
- char coefOverclock[TAILLE_MAX];
- }processeur;
- typedef struct caracEcran{
- char marque[TAILLE_MAX];
- char modele[TAILLE_MAX];
- char taille[TAILLE_MAX];
- char resolMax[TAILLE_MAX];
- char typePort[TAILLE_MAX];
- char uniqueSellingPoint[TAILLE_MAX];
- char fiab[TAILLE_MAX];
- char restriction[TAILLE_MAX];
- char prix[TAILLE_MAX];
- char indiceDePerf[TAILLE_MAX];
- char consoElec[TAILLE_MAX];
- }caracEcran;
- typedef struct Ram{
- char marque[TAILLE_MAX];
- char modele[TAILLE_MAX];
- char ver_ram[TAILLE_MAX];
- char freq[TAILLE_MAX];
- char ram_mod[TAILLE_MAX];
- char fiab[TAILLE_MAX];
- char restrict[TAILLE_MAX];
- char prix[TAILLE_MAX];
- char perform[TAILLE_MAX];
- char cons_elec[TAILLE_MAX];
- char overclock[TAILLE_MAX];
- }Ram;
- typedef struct Soft{
- char soft[TAILLE_MAX];//Nom du logiciel
- char ram[TAILLE_MAX];//RAM nécessaire
- char rom[TAILLE_MAX];//Espace disque nécessaire
- char puis_graph[TAILLE_MAX];//Puissance graphique nécessaire (X = aucun pré-requis)
- char puis_proc[TAILLE_MAX];//Puissance processeur nécessaire
- char usp[TAILLE_MAX];//Unique Selling Points nécessaires (X = aucun pré-requis)
- }Soft;
- char** str_split(char* str, char delim){
- // Define a function to do more than strtok
- // str_split will return an array of all delimited string
- char** ret;
- int retLen;
- char* c;
- if ((str == NULL ) || (delim == '\0'))
- {
- /* Either of those will cause problems */
- ret = NULL;
- retLen = -1;
- }
- else
- {
- retLen = 0;
- c = str;
- /* Pre-calculate number of elements */
- do
- {
- if (*c == delim)
- retLen++;
- c++;
- } while (*c != '\0');
- ret = malloc((retLen + 1) * sizeof(*ret));
- ret[retLen] = NULL;
- c = str;
- retLen = 1;
- ret[0] = str;
- do
- {
- if (*c == delim)
- {
- ret[retLen++] = &c[1];
- *c = '\0';
- }
- c++;
- } while ( *c != '\0' );
- }
- return ret;
- }
- void ouverture_motherboard(Motherboard motherboard_array[10]){
- FILE* fichier = NULL;
- char caractere[TAILLE_MAX];
- fichier = fopen("MOTHERBOARD.csv", "r");
- if(fichier != NULL)
- {
- }
- else
- {
- printf("impossible d'ouvrir le fichier");
- }
- // Define our motherboard array to store all lines in CSV file
- int cpt = 0;
- // get the whole line for each
- while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
- {
- // Get all the strings delimited by a ';'
- char ** array = str_split(caractere, ';');
- // Define a new structure
- Motherboard motherboard;
- // copy the content of each properties in the structure
- strcpy(motherboard.marque, array[0]);
- strcpy(motherboard.modele, array[1]);
- strcpy(motherboard.socket_proc, array[2]);
- strcpy(motherboard.nbr_socket, array[3]);
- strcpy(motherboard.nbr_ram, array[4]);
- strcpy(motherboard.ver_ram, array[5]);
- strcpy(motherboard.nbr_pci, array[10]);
- strcpy(motherboard.nbr_ide, array[7]);
- strcpy(motherboard.nbr_sata, array[8]);
- strcpy(motherboard.nbr_usb, array[9]);
- strcpy(motherboard.nbr_vga, array[10]);
- strcpy(motherboard.nbr_dvi, array[11]);
- strcpy(motherboard.nbr_reseau, array[12]);
- strcpy(motherboard.format, array[13]);
- strcpy(motherboard.usp, array[14]);
- strcpy(motherboard.fiab, array[15]);
- strcpy(motherboard.restrict, array[16]);
- strcpy(motherboard.prix, array[17]);
- strcpy(motherboard.conso_elec, array[18]);
- strcpy(motherboard.overclock, array[19]);
- // add this structure in the array defined previousment
- motherboard_array[cpt++] = motherboard;
- }
- fclose(fichier);
- }
- void ouverture_graphics(Graphics graphics_array[6]){
- FILE* fichier = NULL;
- char caractere[TAILLE_MAX];
- fichier = fopen("GRAPHICS.csv", "r");
- if(fichier != NULL)
- {
- }
- else
- {
- printf("impossible d'ouvrir le fichier");
- }
- // Define our graphics array to store all lines in CSV file
- int cpt = 0;
- // get the whole line for each
- while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
- {
- // Get all the strings delimited by a ';'
- char ** array = str_split(caractere, ';');
- // Define a new structure
- Graphics graphics;
- // copy the content of each properties in the structure
- strcpy(graphics.marque, array[0]);
- strcpy(graphics.modele, array[1]);
- strcpy(graphics.nbr_vga, array[2]);
- strcpy(graphics.nbr_dvi, array[3]);
- strcpy(graphics.nbr_hdmi, array[4]);
- strcpy(graphics.nbr_minidp, array[5]);
- strcpy(graphics.usp, array[6]);
- strcpy(graphics.fiab, array[7]);
- strcpy(graphics.restrict, array[8]);
- strcpy(graphics.prix, array[9]);
- strcpy(graphics.perf, array[10]);
- strcpy(graphics.conso_elec, array[11]);
- strcpy(graphics.overclock, array[12]);
- // add this structure in the array defined previousment
- graphics_array[cpt++] = graphics;
- }
- fclose(fichier);
- }
- void ouverture_hdd(Hdd hdd_array[9]){
- FILE* fichier = NULL;
- char caractere[TAILLE_MAX];
- fichier = fopen("HDD.csv", "r");
- if(fichier != NULL)
- {
- }
- else
- {
- printf("impossible d'ouvrir le fichier");
- }
- // Define our hdd array to store all lines in CSV file
- int cpt = 0;
- // get the whole line for each
- while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
- {
- // Get all the strings delimited by a ';'
- char ** array = str_split(caractere, ';');
- // Define a new structure
- Hdd hdd;
- // copy the content of each properties in the structure
- strcpy(hdd.marque, array[0]);
- strcpy(hdd.modele, array[1]);
- strcpy(hdd.capa, array[2]);
- strcpy(hdd.port, array[3]);
- strcpy(hdd.usp, array[4]);
- strcpy(hdd.fiab, array[5]);
- strcpy(hdd.restrict, array[6]);
- strcpy(hdd.prix, array[7]);
- strcpy(hdd.perf, array[8]);
- strcpy(hdd.conso_elec, array[9]);
- // add this structure in the array defined previousment
- hdd_array[cpt++] = hdd;
- }
- fclose(fichier);
- }
- void ouverture_proco(processeur proco_array[11]){
- FILE* fichier = NULL;
- char caractere[TAILLE_MAX];
- fichier = fopen("PROCO.csv", "r");
- if(fichier != NULL)
- {
- }
- else
- {
- printf("impossible d'ouvrir le fichier");
- }
- // Define our proco array to store all lines in CSV file
- int cpt = 0;
- // get the whole line for each
- while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
- {
- // Get all the strings delimited by a ';'
- char ** array = str_split(caractere, ';');
- // Define a new structure
- processeur proco;
- // copy the content of each properties in the structure
- strcpy(proco.marque, array[0]);
- strcpy(proco.modele, array[1]);
- strcpy(proco.socket, array[2]);
- strcpy(proco.frequence, array[3]);
- strcpy(proco.nbemplacementRam, array[4]);
- strcpy(proco.uniqueSellingPoint, array[5]);
- strcpy(proco.fiab, array[6]);
- strcpy(proco.restriction, array[7]);
- strcpy(proco.prix, array[8]);
- strcpy(proco.indiceDePerf, array[9]);
- strcpy(proco.consoElec, array[10]);
- strcpy(proco.coefOverclock, array[11]);
- // add this structure in the array defined previousment
- proco_array[cpt++] = proco;
- }
- fclose(fichier);
- }
- void ouverture_Ecran(caracEcran ecran_array[9]){
- FILE* fichier = NULL;
- char caractere[TAILLE_MAX];
- fichier = fopen("ECRAN.csv", "r");
- if(fichier != NULL)
- {
- }
- else
- {
- printf("impossible d'ouvrir le fichier");
- }
- // Define our proco array to store all lines in CSV file
- int cpt = 0;
- // get the whole line for each
- while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
- {
- // Get all the strings delimited by a ';'
- char ** array = str_split(caractere, ';');
- // Define a new structure
- caracEcran ecran;
- // copy the content of each properties in the structure
- strcpy(ecran.marque, array[0]);
- strcpy(ecran.modele, array[1]);
- strcpy(ecran.taille, array[2]);
- strcpy(ecran.resolMax, array[3]);
- strcpy(ecran.typePort, array[4]);
- strcpy(ecran.uniqueSellingPoint, array[5]);
- strcpy(ecran.fiab, array[6]);
- strcpy(ecran.restriction, array[7]);
- strcpy(ecran.prix, array[8]);
- strcpy(ecran.indiceDePerf, array[9]);
- strcpy(ecran.consoElec, array[10]);
- // add this structure in the array defined previousment
- ecran_array[cpt++] = ecran;
- }
- fclose(fichier);
- }
- void ouverture_ram(Ram ram_array[18]){
- FILE* fichier = NULL;
- char caractere[TAILLE_MAX];
- fichier = fopen("RAM.csv", "r");
- if(fichier != NULL)
- {
- }
- else
- {
- printf("impossible d'ouvrir le fichier");
- }
- // Define our ram array to store all lines in CSV file
- int cpt = 0;
- // get the whole line for each
- while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
- {
- // Get all the strings delimited by a ';'
- char ** array = str_split(caractere, ';');
- // Define a new structure
- Ram ram;
- // copy the content of each properties in the structure
- strcpy(ram.marque, array[0]);
- strcpy(ram.modele, array[1]);
- strcpy(ram.ver_ram, array[2]);
- strcpy(ram.freq, array[3]);
- strcpy(ram.ram_mod, array[4]);
- strcpy(ram.fiab, array[5]);
- strcpy(ram.restrict, array[6]);
- strcpy(ram.prix, array[7]);
- strcpy(ram.perform, array[8]);
- strcpy(ram.cons_elec, array[9]);
- strcpy(ram.overclock, array[10]);
- // add this structure in the array defined previousment
- ram_array[cpt++] = ram;
- }
- fclose(fichier);
- }
- void ouverture_soft(Soft soft_array[6]){
- FILE* fichier = NULL;
- char caractere[TAILLE_MAX];
- fichier = fopen("SOFTS.csv", "r");
- if(fichier != NULL)
- {
- }
- else
- {
- printf("impossible d'ouvrir le fichier");
- }
- // Define our soft array to store all lines in CSV file
- int cpt = 0;
- // get the whole line for each
- while(fgets(caractere, TAILLE_MAX, fichier) != NULL)
- {
- // Get all the strings delimited by a ';'
- char ** array = str_split(caractere, ';');
- // Define a new structure
- Soft soft;
- // copy the content of each properties in the structure
- strcpy(soft.soft, array[0]);
- strcpy(soft.ram, array[1]);
- strcpy(soft.rom, array[2]);
- strcpy(soft.puis_graph, array[3]);
- strcpy(soft.puis_proc, array[4]);
- strcpy(soft.usp, array[5]);
- // add this structure in the array defined previousment
- soft_array[cpt++] = soft;
- }
- fclose(fichier);
- }
- void affichage_ram(){
- printf("1: Marque\n");
- printf("2: Modele\n");
- printf("3: Version de la RAM\n");
- printf("4: Frequence\n");
- printf("5: Quantite par module\n");
- printf("6: Taux de fiabilite du materiel\n");
- printf("7: Prix\n");
- printf("8: Indice de performance\n");
- printf("9: Consommation electrique\n");
- printf("10: Coefficient d'overclocking\n\n");
- printf("0: Quitter la selection\n\n");
- }
- void affichage_graphics(){
- printf("1: Marque\n");
- printf("2: Modele\n");
- printf("3: Nombre de ports VGA\n");
- printf("4: Nombre de ports DVI\n");
- printf("5: Nombre de ports HDMI\n");
- printf("6: Nombre de ports MINIDP\n");
- printf("7: Unique Selling Points\n");
- printf("8: Taux de fiabilite\n");
- printf("9: Restrictions d'usage\n");
- printf("10: Prix\n");
- printf("11: Indice de performance\n");
- printf("12: Consommation electrique\n");
- printf("13: Coefficient d'overclocking\n\n");
- printf("0: Quitter la selection\n\n");
- }
- void affichage_motherboard(){
- printf("1: Marque\n");
- printf("2: Modele\n");
- printf("3: Type de socket processeur\n");
- printf("4: Nombre de socket\n");
- printf("5: Nombre d'emplacement de RAM\n");
- printf("6: Version de la RAM\n");
- printf("7: Nombre de ports PCIE 16\n");
- printf("8: Nombre de ports IDE\n");
- printf("9: Nombre de ports SATA\n");
- printf("10: Nombre de ports USB\n");
- printf("11: Nombre de ports VGA\n");
- printf("12: Nombre de ports DVI\n");
- printf("13: Nombre de ports reseau\n");
- printf("14: Format de la carte\n");
- printf("15: Unique Selling Points\n");
- printf("16: Taux de fiabilite\n");
- printf("17: Restrictions d'usage\n");
- printf("18: Prix\n");
- printf("19: Consommation electrique\n");
- printf("20: Coefficient d'overclocking\n\n");
- printf("0: Quitter la selection\n\n");
- }
- void affichage_ecran(){
- printf("1: Marque\n");
- printf("2: Modele\n");
- printf("3: Taille(en pouces)\n");
- printf("4: Resolution maximale\n");
- printf("5: Type de port\n");
- printf("6: Unique Selling Points\n");
- printf("7: Taux de fiabilite\n");
- printf("8: Restrictions d'usage\n");
- printf("9: Prix\n");
- printf("10: Indice de performance\n");
- printf("11: Consommation electrique\n\n");
- printf("0: Quitter la selection\n\n");
- }
- void affichage_hdd(){
- printf("1: Marque\n");
- printf("2: Modele\n");
- printf("3: Espace disque (en Go)\n");
- printf("4: Type de port\n");
- printf("5: Unique Selling Points\n");
- printf("6: Taux de fiabilite\n");
- printf("7: Restrictions d'usage\n");
- printf("8: Prix\n");
- printf("9: Indice de performance\n");
- printf("10: Consommation electrique\n\n");
- printf("0: Quitter la selection\n\n");
- }
- void affichage_proco(){
- printf("1: Marque\n");
- printf("2: Modele\n");
- printf("3: Type de socket processeur\n");
- printf("4: Frequence\n");
- printf("5: Nombre d'emplacement de RAM supporte\n");
- printf("6: Unique Selling Points\n");
- printf("7: Taux de fiabilite\n");
- printf("8: Restrictions d'usage\n");
- printf("9: Prix\n");
- printf("10: Indice de performance\n");
- printf("11: Consommation electrique\n");
- printf("12: Codefficient d'overclocking\n\n");
- printf("0: Quitter la selection\n\n");
- }
- void affichage_soft(){
- printf("1: Nom du logiciel\n");
- printf("2: RAM necessaire\n");
- printf("3: Espace disque necessaire\n");
- printf("4: Puissance graphique necessaire\n");
- printf("5: Puissance processeur necessaire\n");
- printf("6: Unique Selling Points\n\n");
- printf("0: Quitter la selection\n\n");
- }
- void aff_tab_proco(processeur hist_proco[11], int sz){
- int i;
- printf ("Mrq\tMdl\tSckt\tFreq\tRAM\tUSP\t\tFiab\tRestr\tPrix\tPerf\tCns el\tOvrck\n");
- for (i=0; i<sz; i++)
- {
- printf ("%s\t%s\t%s\t%s\t%s\t%s\t\t%s\t%s\t%s\t%s\t%s\t%s\n", hist_proco[i].marque, hist_proco[i].modele, hist_proco[i].socket, hist_proco[i].frequence, hist_proco[i].nbemplacementRam, hist_proco[i].uniqueSellingPoint, hist_proco[i].fiab, hist_proco[i].restriction, hist_proco[i].prix, hist_proco[i].indiceDePerf, hist_proco[i].consoElec, hist_proco[i].coefOverclock);
- }
- }
- void aff_tab_graphics(Graphics hist_graphic[6], int sz){
- int i;
- printf ("Mrq\tMdl\tVGA\tDVI\tHDMI\tMINIDP\tUSP\tFiab\tRestrict\tPrix\tPerf\tCns el\tOvrclck\n");
- for(i=0; i<sz; i++)
- {
- printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", hist_graphic[i].marque, hist_graphic[i].modele, hist_graphic[i].nbr_vga, hist_graphic[i].nbr_dvi, hist_graphic[i].nbr_hdmi, hist_graphic[i].nbr_minidp, hist_graphic[i].usp, hist_graphic[i].fiab, hist_graphic[i].restrict, hist_graphic[i].prix, hist_graphic[i].perf, hist_graphic[i].conso_elec, hist_graphic[i].overclock);
- }
- }
- void aff_tab_soft(Soft hist_soft[6], int sz){
- int i;
- printf ("Nom\tRAM Ness\tEspace\tPuissance graph\tPuissance processeur\tUSP\n");
- for (i=0; i<sz; i++)
- {
- printf ("%s\t%s\t%s\t%s\t%s\t%s\n", hist_soft[i].soft, hist_soft[i].ram, hist_soft[i].rom, hist_soft[i].puis_graph, hist_soft[i].puis_proc, hist_soft[i].usp);
- }
- }
- void aff_tab_hdd(Hdd hist_hdd[9], int sz){
- int i;
- printf ("Marque\tModele\tCapacite\tPort\tUSP\tFiabilite\tRestriction\tPrix\tPerf\tConsommation\n");
- for (i=0; i<sz; i++)
- {
- printf ("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", hist_hdd[i].marque, hist_hdd[i].modele, hist_hdd[i].capa, hist_hdd[i].port, hist_hdd[i].usp, hist_hdd[i].fiab, hist_hdd[i].restrict, hist_hdd[i].prix, hist_hdd[i].perf, hist_hdd[i].conso_elec);
- }
- }
- void aff_tab_motherboard(Motherboard hist_motherboard[10], int sz){
- int i;
- printf("Mrq\tMdl\tSckt\tNbrSckt\tNbrRAM\tVerRAM\tPCIE 16\tIDE\tSATA\tUSB\tVGA\tDVI\tReseau\tFormat\tUSP\tFiab\tRestrict\tPrix\tCns El\tOvrclck\n");
- for (i=0; i<sz; i++)
- {
- printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", hist_motherboard[i].marque, hist_motherboard[i].modele, hist_motherboard[i].socket_proc, hist_motherboard[i].nbr_socket, hist_motherboard[i].nbr_ram, hist_motherboard[i].ver_ram, hist_motherboard[i].nbr_pci, hist_motherboard[i].nbr_ide, hist_motherboard[i].nbr_sata, hist_motherboard[i].nbr_usb, hist_motherboard[i].nbr_vga, hist_motherboard[i].nbr_dvi, hist_motherboard[i].nbr_reseau, hist_motherboard[i].format, hist_motherboard[i].usp, hist_motherboard[i].fiab, hist_motherboard[i].restrict, hist_motherboard[i].prix, hist_motherboard[i].conso_elec, hist_motherboard[i].overclock);
- }
- }
- void aff_tab_ecran(caracEcran hist_ecran[9], int sz){
- int i;
- printf ("Mrq\tMdl\tTaille\tResol\tPort\tUSP\t\tFiab\tRestric\tPrix\tPerf \tConso\n");
- for (i=0; i<sz; i++)
- {
- printf ("%s\t%s\t%s\t%s\t%s\t%s\t\t%s\t%s\t%s\t%s\t%s\n", hist_ecran[i].marque, hist_ecran[i].modele, hist_ecran[i].taille, hist_ecran[i].resolMax, hist_ecran[i].typePort, hist_ecran[i].uniqueSellingPoint, hist_ecran[i].fiab, hist_ecran[i].restriction, hist_ecran[i].prix, hist_ecran[i].indiceDePerf, hist_ecran[i].consoElec );
- }
- }
- void aff_tab_ram(Ram hist_ram[18], int sz){
- int i;
- printf ("Mrq\tMdl\tVersion\tFreq\tRAM\tMod\t\tFiab\tPrix\tPerf\tCns el\tOvrck\n");
- for (i=0; i<sz; i++)
- {
- printf ("%s\t%s\t%s\t%s\t%s\t%s\t\t%s\t%s\t%s\t%s\t%s\n", hist_ram[i].marque, hist_ram[i].modele, hist_ram[i].ver_ram, hist_ram[i].freq, hist_ram[i].ram_mod, hist_ram[i].fiab, hist_ram[i].restrict, hist_ram[i].prix, hist_ram[i].perform, hist_ram[i].cons_elec, hist_ram[i].overclock);
- }
- }
- void demande_proco(processeur proco_array[11], processeur* proco_recherche, processeur hist_proco[11], int sz_proco){
- system("cls");
- int rep;
- processeur nv_proco[11];
- int i;
- int j=0;
- int k=0;
- printf("Quel parametres souhaitez vous parametrer?\n");
- affichage_proco();
- aff_tab_proco(proco_array, sz_proco);
- scanf("%d", &rep);
- if(rep==0)
- {
- //FILE* proco;
- //proco = fopen ("proco.txt","w+");
- //while (l<k)
- //{
- // fprintf(proco, "%s", );
- // l++;
- //}
- return;
- }
- if(rep==1)
- {
- printf("Saisir la marque souhaitee\n");
- scanf("%s", proco_recherche->marque);
- for(i=0; i<8; i++)
- {
- if (strcmp(proco_recherche->marque, proco_array[i].marque)==0)
- {
- j++;
- hist_proco[k]=proco_array[i];
- k++;
- }
- }
- }
- if(rep==2)
- {
- printf("Saisir le modele souhaite\n");
- scanf("%s", proco_recherche->modele);
- for(i=0; i<8; i++)
- {
- if (strcmp(proco_recherche->modele, proco_array[i].modele)==0)
- {
- j++;
- hist_proco[k]=proco_array[i];
- k++;
- }
- }
- }
- if(rep==3)
- {
- printf("Saisir le type de socket souhaite\n");
- scanf("%s", proco_recherche->socket);
- for(i=0; i<8; i++)
- {
- if (strcmp(proco_recherche->socket, proco_array[i].socket)==0)
- {
- j++;
- hist_proco[k]=proco_array[i];
- k++;
- }
- }
- }
- if(rep==4)
- {
- printf("Saisir la frequence souhaitee\n");
- scanf("%s", proco_recherche->frequence);
- for(i=0; i<8; i++)
- {
- if (strcmp(proco_recherche->frequence, proco_array[i].frequence)==0)
- {
- j++;
- hist_proco[k]=proco_array[i];
- k++;
- }
- }
- }
- if(rep==5)
- {
- printf("Saisir le nombre d'emplacement RAM souhaite\n");
- scanf("%s", proco_recherche->nbemplacementRam);
- for(i=0; i<8; i++)
- {
- if (strcmp(proco_recherche->nbemplacementRam, proco_array[i].nbemplacementRam)==0)
- {
- j++;
- hist_proco[k]=proco_array[i];
- k++;
- }
- }
- }
- if(rep==6)
- {
- printf("Saisir l'USP souhaite\n");
- scanf("%s", proco_recherche->uniqueSellingPoint);
- for(i=0; i<8; i++)
- {
- if (strcmp(proco_recherche->uniqueSellingPoint, proco_array[i].uniqueSellingPoint)==0)
- {
- j++;
- hist_proco[k]=proco_array[i];
- k++;
- }
- }
- }
- if(rep==7)
- {
- printf("Saisir le taux de fiabilite souhaite\n");
- scanf("%s", proco_recherche->fiab);
- for(i=0; i<8; i++)
- {
- if (strcmp(proco_recherche->fiab, proco_array[i].fiab)==0)
- {
- j++;
- hist_proco[k]=proco_array[i];
- k++;
- }
- }
- }
- if(rep==8)
- {
- printf("Saisir les restrictions d'usage souhaitees\n");
- scanf("%s", proco_recherche->restriction);
- for(i=0; i<8; i++)
- {
- if (strcmp(proco_recherche->restriction, proco_array[i].restriction)==0)
- {
- j++;
- hist_proco[k]=proco_array[i];
- k++;
- }
- }
- }
- if(rep==9)
- {
- printf("Saisir le prix souhaite\n");
- scanf("%s", proco_recherche->prix);
- for(i=0; i<8; i++)
- {
- if (strcmp(proco_recherche->prix, proco_array[i].prix)==0)
- {
- j++;
- hist_proco[k]=proco_array[i];
- k++;
- }
- }
- }
- if(rep==10)
- {
- printf("Saisir la consommation electrique souhaitee\n");
- scanf("%s", proco_recherche->consoElec);
- for(i=0; i<8; i++)
- {
- if (strcmp(proco_recherche->consoElec, proco_array[i].consoElec)==0)
- {
- j++;
- hist_proco[k]=proco_array[i];
- k++;
- }
- }
- }
- if(rep==11)
- {
- printf("Saisir le coefficient d'overclocking souhaite\n");
- scanf("%s", proco_recherche->coefOverclock);
- for(i=0; i<8; i++)
- {
- if (strcmp(proco_recherche->coefOverclock, proco_array[i].coefOverclock)==0)
- {
- j++;
- hist_proco[k]=proco_array[i];
- k++;
- }
- }
- }
- if (j!=0) printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- sz_proco=k+1;
- demande_proco(hist_proco, proco_recherche, nv_proco, sz_proco);
- }
- void demande_ram(Ram ram_array[18], Ram* ram_recherche, Ram hist_ram[18], int sz_ram){
- int rep;
- int i,j=0;
- int k=0;
- Ram nv_ram[18];
- system("cls");
- printf("Quel parametres souhaitez vous parametrer?\n");
- affichage_ram();
- aff_tab_ram(ram_array, sz_ram);
- scanf("%d", &rep);
- if(rep==0)
- {
- return;
- }
- if(rep==1)
- {
- printf("Saisir la marque souhaitee\n");
- scanf("%s", ram_recherche->marque);
- for(i=0; i<18; i++)
- {
- if (strcmp(ram_recherche->marque, ram_array[i].marque)==0)
- {
- j++;
- hist_ram[k]=ram_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==2)
- {
- printf("Saisir le modele souhaite\n");
- scanf("%s", ram_recherche->modele);
- for(i=0; i<18; i++)
- {
- if (strcmp(ram_recherche->modele, ram_array[i].modele)==0)
- {
- j++;
- hist_ram[k]=ram_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==3)
- {
- printf("Saisir la version de la ram\n");
- scanf("%s", ram_recherche->ver_ram);
- for(i=0; i<18; i++)
- {
- if (strcmp(ram_recherche->ver_ram, ram_array[i].ver_ram)==0)
- {
- j++;
- hist_ram[k]=ram_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==4)
- {
- printf("Saisir la frequence\n");
- scanf("%s", ram_recherche->freq);
- for(i=0; i<18; i++)
- {
- if (strcmp(ram_recherche->freq, ram_array[i].freq)==0)
- {
- j++;
- hist_ram[k]=ram_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==5)
- {
- printf("Saisir la quantité par module\n");
- scanf("%s", ram_recherche->ram_mod);
- for(i=0; i<18; i++)
- {
- if (strcmp(ram_recherche->ram_mod, ram_array[i].ver_ram)==0)
- {
- j++;
- hist_ram[k]=ram_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==6)
- {
- printf("Saisir le taux de fiabilite\n");
- scanf("%s", ram_recherche->fiab);
- for(i=0; i<18; i++)
- {
- if (strcmp(ram_recherche->fiab, ram_array[i].ver_ram)==0)
- {
- j++;
- hist_ram[k]=ram_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==7)
- {
- printf("Saisir le prix\n");
- scanf("%s", ram_recherche->prix);
- for(i=0; i<18; i++)
- {
- if (strcmp(ram_recherche->prix, ram_array[i].ver_ram)==0)
- {
- j++;
- hist_ram[k]=ram_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==8)
- {
- printf("Saisir l'indice de performance\n");
- scanf("%s", ram_recherche->perform);
- for(i=0; i<18; i++)
- {
- if (strcmp(ram_recherche->perform, ram_array[i].ver_ram)==0)
- {
- j++;
- hist_ram[k]=ram_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==9)
- {
- printf("Saisir la consommation electrique\n");
- scanf("%s", ram_recherche->cons_elec);
- for(i=0; i<18; i++)
- {
- if (strcmp(ram_recherche->cons_elec, ram_array[i].ver_ram)==0)
- {
- j++;
- hist_ram[k]=ram_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==10)
- {
- printf("Saisir le coefficient d'overclocking\n");
- scanf("%s", ram_recherche->overclock);
- for(i=0; i<18; i++)
- {
- if (strcmp(ram_recherche->overclock, ram_array[i].ver_ram)==0)
- {
- j++;
- hist_ram[k]=ram_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- demande_ram(hist_ram, ram_recherche, nv_ram, k+1);
- }
- void demande_graphics(Graphics graphics_array[6], Graphics* graphics_recherche, Graphics hist_graphic[6], int sz_graphic){
- int rep;
- int i;
- int j=0;
- int k=0;
- Graphics nv_graphic[6];
- system("cls");
- printf("Quel parametres souhaitez vous parametrer?\n");
- affichage_graphics();
- aff_tab_graphics(graphics_array, sz_graphic);
- scanf("%d", &rep);
- if(rep==0)
- {
- return;
- }
- if(rep==1)
- {
- printf("Saisir la marque souhaitee\n");
- scanf("%s", graphics_recherche->marque);
- for(i=0; i<6; i++)
- {
- if (strcmp(graphics_recherche->marque, graphics_array[i].marque)==0)
- {
- j++;
- hist_graphic[k]=graphics_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==2)
- {
- printf("Saisir le modele souhaite\n");
- scanf("%s", graphics_recherche->modele);
- for(i=0; i<6; i++)
- {
- if (strcmp(graphics_recherche->modele, graphics_array[i].modele)==0)
- {
- j++;
- hist_graphic[k]=graphics_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==3)
- {
- printf("Saisir le nombre de ports VGA\n");
- scanf("%s", graphics_recherche->nbr_vga);
- for(i=0; i<6; i++)
- {
- if (strcmp(graphics_recherche->nbr_vga, graphics_array[i].nbr_vga)==0)
- {
- j++;
- hist_graphic[k]=graphics_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==4)
- {
- printf("Saisir le nombre de ports DVI\n");
- scanf("%s", graphics_recherche->nbr_dvi);
- for(i=0; i<6; i++)
- {
- if (strcmp(graphics_recherche->nbr_dvi, graphics_array[i].nbr_dvi)==0)
- {
- j++;
- hist_graphic[k]=graphics_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==5)
- {
- printf("Saisir le nombre de ports HDMI\n");
- scanf("%s", graphics_recherche->nbr_hdmi);
- for(i=0; i<6; i++)
- {
- if (strcmp(graphics_recherche->nbr_hdmi, graphics_array[i].nbr_hdmi)==0)
- {
- j++;
- hist_graphic[k]=graphics_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==6)
- {
- printf("Saisir le nombre de ports MINIDP\n");
- scanf("%s", graphics_recherche->nbr_minidp);
- for(i=0; i<6; i++)
- {
- if (strcmp(graphics_recherche->nbr_minidp, graphics_array[i].nbr_minidp)==0)
- {
- j++;
- hist_graphic[k]=graphics_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==7)
- {
- printf("Saisir l'USP\n");
- scanf("%s", graphics_recherche->usp);
- for(i=0; i<6; i++)
- {
- if (strcmp(graphics_recherche->usp, graphics_array[i].usp)==0)
- {
- j++;
- hist_graphic[k]=graphics_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==8)
- {
- printf("Saisir les restrictions d'usage\n");
- scanf("%s", graphics_recherche->restrict);
- for(i=0; i<6; i++)
- {
- if (strcmp(graphics_recherche->restrict, graphics_array[i].restrict)==0)
- {
- j++;
- hist_graphic[k]=graphics_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==9)
- {
- printf("Saisir le prix\n");
- scanf("%s", graphics_recherche->prix);
- for(i=0; i<6; i++)
- {
- if (strcmp(graphics_recherche->prix, graphics_array[i].prix)==0)
- {
- j++;
- hist_graphic[k]=graphics_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- }
- if(rep==10)
- {
- printf("Saisir l'indice de performance\n");
- scanf("%s", graphics_recherche->perf);
- for(i=0; i<6; i++)
- {
- if (strcmp(graphics_recherche->perf, graphics_array[i].perf)==0)
- {
- j++;
- hist_graphic[k]=graphics_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config\n", j);
- system("PAUSE");
- }
- if(rep==11)
- {
- printf("Saisir la consommation electrique\n");
- scanf("%s", graphics_recherche->conso_elec);
- for(i=0; i<6; i++)
- {
- if (strcmp(graphics_recherche->conso_elec, graphics_array[i].conso_elec)==0)
- {
- j++;
- hist_graphic[k]=graphics_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config\n", j);
- system("PAUSE");
- }
- if(rep==12)
- {
- printf("Saisir le coefficient d'overclocking\n");
- scanf("%s", graphics_recherche->overclock);
- for(i=0; i<6; i++)
- {
- if (strcmp(graphics_recherche->overclock, graphics_array[i].overclock)==0)
- {
- j++;
- hist_graphic[k]=graphics_array[i];
- k++;
- }
- }
- printf("Nous avons trouve %d fois votre config\n", j);
- system("PAUSE");
- }
- demande_graphics(hist_graphic, graphics_recherche, nv_graphic, k+1);
- }
- void demande_motherboard(Motherboard motherboard_array[10], Motherboard* motherboard_recherche, Motherboard hist_motherboard[10], int sz_motherboard){
- int rep;
- int i;
- int j=0;
- int k=0;
- Motherboard nv_motherboard[10];
- system("cls");
- printf("Quel parametres souhaitez vous parametrer?\n");
- affichage_motherboard();
- aff_tab_motherboard(motherboard_array, sz_motherboard);
- scanf("%d", &rep);
- if(rep==0)
- {
- return;
- }
- if(rep==1)
- {
- printf("Saisir la marque souhaitee\n");
- scanf("%s", motherboard_recherche->marque);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->marque, motherboard_array[i].marque)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==2)
- {
- printf("Saisir le modele souhaite\n");
- scanf("%s", motherboard_recherche->modele);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->modele, motherboard_array[i].modele)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==3)
- {
- printf("Saisir le type de socket processeur souhaite\n");
- scanf("%s", motherboard_recherche->socket_proc);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->socket_proc, motherboard_array[i].socket_proc)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==4)
- {
- printf("Saisir le nombre de socket souhaite\n");
- scanf("%s", motherboard_recherche->nbr_socket);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->nbr_socket, motherboard_array[i].nbr_socket)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==5)
- {
- printf("Saisir le nombre d'emplacement RAM souhaite\n");
- scanf("%s", motherboard_recherche->nbr_ram);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->nbr_ram, motherboard_array[i].nbr_ram)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==5)
- {
- printf("Saisir la version de la RAM souhaitee\n");
- scanf("%s", motherboard_recherche->ver_ram);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->ver_ram, motherboard_array[i].ver_ram)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==7)
- {
- printf("Saisir le nombre de ports PCIE 16 souhaite\n");
- scanf("%s", motherboard_recherche->nbr_pci);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->nbr_pci, motherboard_array[i].nbr_pci)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==8)
- {
- printf("Saisir le nombre de ports IDE souhaite\n");
- scanf("%s", motherboard_recherche->nbr_ide);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->nbr_ide, motherboard_array[i].nbr_ide)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==9)
- {
- printf("Saisir le nombre de ports SATA souhaite\n");
- scanf("%s", motherboard_recherche->nbr_sata);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->nbr_sata, motherboard_array[i].nbr_sata)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==10)
- {
- printf("Saisir le nombre de ports USB souhaite\n");
- scanf("%s", motherboard_recherche->nbr_usb);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->nbr_usb, motherboard_array[i].nbr_usb)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==11)
- {
- printf("Saisir le nombre de ports VGA souhaite\n");
- scanf("%s", motherboard_recherche->nbr_vga);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->nbr_vga, motherboard_array[i].nbr_vga)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==12)
- {
- printf("Saisir le nombre de ports DVI souhaite\n");
- scanf("%s", motherboard_recherche->nbr_dvi);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->nbr_dvi, motherboard_array[i].nbr_dvi)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==13)
- {
- printf("Saisir le nombre de ports reseau souhaite\n");
- scanf("%s", motherboard_recherche->nbr_reseau);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->nbr_dvi, motherboard_array[i].nbr_dvi)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==14)
- {
- printf("Saisir le format souhaite\n");
- scanf("%s", motherboard_recherche->format);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->format, motherboard_array[i].format)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==15)
- {
- printf("Saisir l'USP souhaite\n");
- scanf("%s", motherboard_recherche->usp);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->usp, motherboard_array[i].usp)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==16)
- {
- printf("Saisir le taux de fiabilité souhaite\n");
- scanf("%s", motherboard_recherche->fiab);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->fiab, motherboard_array[i].fiab)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==17)
- {
- printf("Saisir les restrictions d'usage souhaitees\n");
- scanf("%s", motherboard_recherche->restrict);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->restrict, motherboard_array[i].restrict)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==18)
- {
- printf("Saisir le prix souhaite\n");
- scanf("%s", motherboard_recherche->prix);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->prix, motherboard_array[i].prix)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==19)
- {
- printf("Saisir la consommation electrique souhaitee\n");
- scanf("%s", motherboard_recherche->conso_elec);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->conso_elec, motherboard_array[i].conso_elec)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if(rep==20)
- {
- printf("Saisir le coefficient d'overclocking souhaite\n");
- scanf("%s", motherboard_recherche->overclock);
- for(i=0; i<10; i++)
- {
- if (strcmp(motherboard_recherche->overclock, motherboard_array[i].overclock)==0)
- {
- j++;
- hist_motherboard[k]=motherboard_array[i];
- k++;
- }
- }
- }
- if (j!=0) printf("Nous avons trouve %d fois votre config \n", j);
- system("PAUSE");
- demande_motherboard(hist_motherboard, motherboard_recherche, nv_motherboard, k+1);
- }
- void demande_hdd(Hdd hdd_array[9], Hdd* hdd_recherche, Hdd hist_hdd[9], int sz_hdd){
- int rep;
- int i;
- int j=0;
- int k=0;
- Hdd nv_hdd[9];
- system("cls");
- printf("Quel parametres souhaitez vous parametrer?\n");
- affichage_hdd();
- aff_tab_hdd(hdd_array, sz_hdd);
- scanf("%d", &rep);
- if(rep==0)
- {
- return;
- }
- if(rep==1)
- {
- printf("Saisir la marque souhaitee\n");
- scanf("%s", hdd_recherche->marque);
- for(i=0; i<8; i++)
- {
- if (strcmp(hdd_recherche->marque, hdd_array[i].marque)==0)
- {
- j++;
- hist_hdd[k]=hdd_array[i];
- k++;
- }
- }
- }
- if(rep==2)
- {
- printf("Saisir le modele souhaite\n");
- scanf("%s", hdd_recherche->modele);
- for(i=0; i<8; i++)
- {
- if (strcmp(hdd_recherche->modele, hdd_array[i].modele)==0)
- {
- j++;
- hist_hdd[k]=hdd_array[i];
- k++;
- }
- }
- }
- if(rep==3)
- {
- printf("Saisir l'espace disque (en Go) souhaite\n");
- scanf("%s", hdd_recherche->capa);
- for(i=0; i<8; i++)
- {
- if (strcmp(hdd_recherche->capa, hdd_array[i].capa)==0)
- {
- j++;
- hist_hdd[k]=hdd_array[i];
- k++;
- }
- }
- }
- if(rep==4)
- {
- printf("Saisir le type de port souhaite\n");
- scanf("%s", hdd_recherche->port);
- for(i=0; i<8; i++)
- {
- if (strcmp(hdd_recherche->port, hdd_array[i].port)==0)
- {
- j++;
- hist_hdd[k]=hdd_array[i];
- k++;
- }
- }
- }
- if(rep==5)
- {
- printf("Saisir l'USP souhaite\n");
- scanf("%s", hdd_recherche->usp);
- for(i=0; i<8; i++)
- {
- if (strcmp(hdd_recherche->usp, hdd_array[i].usp)==0)
- {
- j++;
- hist_hdd[k]=hdd_array[i];
- k++;
- }
- }
- }
- if(rep==6)
- {
- printf("Saisir le taux de fiabilite souhaite\n");
- scanf("%s", hdd_recherche->fiab);
- for(i=0; i<8; i++)
- {
- if (strcmp(hdd_recherche->fiab, hdd_array[i].fiab)==0)
- {
- j++;
- hist_hdd[k]=hdd_array[i];
- k++;
- }
- }
- }
- if(rep==7)
- {
- printf("Saisir les restrictions d'usage souhaitees\n");
- scanf("%s", hdd_recherche->restrict);
- for(i=0; i<8; i++)
- {
- if (strcmp(hdd_recherche->restrict, hdd_array[i].restrict)==0)
- {
- j++;
- hist_hdd[k]=hdd_array[i];
- k++;
- }
- }
- }
- if(rep==8)
- {
- printf("Saisir le prix souhaite\n");
- scanf("%s", hdd_recherche->prix);
- for(i=0; i<8; i++)
- {
- if (strcmp(hdd_recherche->prix, hdd_array[i].prix)==0)
- {
- j++;
- hist_hdd[k]=hdd_array[i];
- k++;
- }
- }
- }
- if(rep==9)
- {
- printf("Saisir l'indice de performance souhaite\n");
- scanf("%s", hdd_recherche->perf);
- for(i=0; i<8; i++)
- {
- if (strcmp(hdd_recherche->perf, hdd_array[i].perf)==0)
- {
- j++;
- hist_hdd[k]=hdd_array[i];
- k++;
- }
- }
- }
- if(rep==10)
- {
- printf("Saisir la consommation electrique souhaitee\n");
- scanf("%s", hdd_recherche->conso_elec);
- for(i=0; i<8; i++)
- {
- if (strcmp(hdd_recherche->conso_elec, hdd_array[i].conso_elec)==0)
- {
- j++;
- hist_hdd[k]=hdd_array[i];
- k++;
- }
- }
- }
- if (j!=0) printf("Nous avons trouve %d fois votre config\n", j);
- system("PAUSE");
- demande_hdd(hist_hdd, hdd_recherche, nv_hdd, k+1);
- }
- void demande_ecran(caracEcran ecran_array[9], caracEcran* ecran_recherche, caracEcran hist_ecran[9], int sz_ecran){
- int rep;
- int i;
- int j=0;
- int k=0;
- caracEcran nv_ecran[9];
- system("cls");
- printf("Quel parametres souhaitez vous parametrer?\n");
- affichage_ecran();
- aff_tab_ecran(ecran_array, sz_ecran);
- scanf("%d", &rep);if(rep==0)
- {
- return;
- }
- if(rep==1)
- {
- printf("Saisir la marque souhaitee\n");
- scanf("%s", ecran_recherche->marque);
- for(i=0; i<5; i++)
- {
- if (strcmp(ecran_recherche->marque, ecran_array[i].marque)==0)
- {
- j++;
- hist_ecran[k]=ecran_array[i];
- k++;
- }
- }
- }
- if(rep==2)
- {
- printf("Saisir le modele souhaite\n");
- scanf("%s", ecran_recherche->modele);
- for(i=0; i<5; i++)
- {
- if (strcmp(ecran_recherche->modele, ecran_array[i].modele)==0)
- {
- j++;
- hist_ecran[k]=ecran_array[i];
- k++;
- }
- }
- }
- if(rep==3)
- {
- printf("Saisir la taille en pouce souhaite\n");
- scanf("%s", ecran_recherche->taille);
- for(i=0; i<5; i++)
- {
- if (strcmp(ecran_recherche->taille, ecran_array[i].taille)==0)
- {
- j++;
- hist_ecran[k]=ecran_array[i];
- k++;
- }
- }
- }
- if(rep==4)
- {
- printf("Saisir la resolution maximale souhaitée\n");
- scanf("%s", ecran_recherche->resolMax);
- for(i=0; i<5; i++)
- {
- if (strcmp(ecran_recherche->resolMax, ecran_array[i].resolMax)==0)
- {
- j++;
- hist_ecran[k]=ecran_array[i];
- k++;
- }
- }
- }
- if(rep==5)
- {
- printf("Saisir le type de port souhaite\n");
- scanf("%s", ecran_recherche->typePort);
- for(i=0; i<5; i++)
- {
- if (strcmp(ecran_recherche->typePort, ecran_array[i].typePort)==0)
- {
- j++;
- hist_ecran[k]=ecran_array[i];
- k++;
- }
- }
- }
- if(rep==6)
- {
- printf("Saisir le seul point de vente souhaite\n");
- scanf("%s", ecran_recherche->uniqueSellingPoint);
- for(i=0; i<5; i++)
- {
- if (strcmp(ecran_recherche->uniqueSellingPoint, ecran_array[i].uniqueSellingPoint)==0)
- {
- j++;
- hist_ecran[k]=ecran_array[i];
- k++;
- }
- }
- }
- if(rep==7)
- {
- printf("Saisir le taux de fiabilité souhaitees\n");
- scanf("%s", ecran_recherche->fiab);
- for(i=0; i<5; i++)
- {
- if (strcmp(ecran_recherche->fiab, ecran_array[i].fiab)==0)
- {
- j++;
- hist_ecran[k]=ecran_array[i];
- k++;
- }
- }
- }
- if(rep==8)
- {
- printf("Saisir les restrictions d'usage souhaites\n");
- scanf("%s", ecran_recherche->restriction);
- for(i=0; i<5; i++)
- {
- if (strcmp(ecran_recherche->restriction, ecran_array[i].restriction)==0)
- {
- j++;
- hist_ecran[k]=ecran_array[i];
- k++;
- }
- }
- }
- if(rep==9)
- {
- printf("Saisir le prix souhaite\n");
- scanf("%s", ecran_recherche->prix);
- for(i=0; i<5; i++)
- {
- if (strcmp(ecran_recherche->prix, ecran_array[i].prix)==0)
- {
- j++;
- hist_ecran[k]=ecran_array[i];
- k++;
- }
- }
- }
- if(rep==10)
- {
- printf("Saisir l'indice de performance souhaitee\n");
- scanf("%s", ecran_recherche->indiceDePerf);
- for(i=0; i<5; i++)
- {
- if (strcmp(ecran_recherche->indiceDePerf, ecran_array[i].indiceDePerf)==0)
- {
- j++;
- hist_ecran[k]=ecran_array[i];
- k++;
- }
- }
- }
- if(rep==11)
- {
- printf("Saisir la consommation electrique souhaitee\n");
- scanf("%s", ecran_recherche->consoElec);
- for(i=0; i<5; i++)
- {
- if (strcmp(ecran_recherche->consoElec, ecran_array[i].consoElec)==0)
- {
- j++;
- hist_ecran[k]=ecran_array[i];
- k++;
- }
- }
- }
- if (j!=0) printf("Nous avons trouve %d fois votre config\n", j);
- system("PAUSE");
- demande_ecran(hist_ecran, ecran_recherche, nv_ecran, k+1);
- }
- void demande_soft(Soft soft_array[6], Soft* soft_recherche, Soft hist_soft[6], int sz_soft){
- int rep;
- int i;
- int j=0;
- int k=0;
- Soft nv_soft[6];
- system("cls");
- printf("Quel parametres souhaitez vous parametrer?\n");
- affichage_soft();
- aff_tab_soft(soft_array, sz_soft);
- scanf("%d", &rep);
- if(rep==0)
- {
- return;
- }
- if(rep==1)
- {
- printf("Saisir le logiciel souhaite\n");
- scanf("%s", soft_recherche->soft);
- for(i=0; i<6; i++)
- {
- if (strcmp(soft_recherche->soft, soft_array[i].soft)==0)
- {
- j++;
- hist_soft[k]=soft_array[i];
- k++;
- }
- }
- }
- if(rep==2)
- {
- printf("Saisir la RAM necessaire souhaite\n");
- scanf("%s", soft_recherche->ram);
- for(i=0; i<6; i++)
- {
- if (strcmp(soft_recherche->ram, soft_array[i].ram)==0)
- {
- j++;
- hist_soft[k]=soft_array[i];
- k++;
- }
- }
- }
- if(rep==3)
- {
- printf("Saisir l'espace disque (en Go) necessaire souhaite\n");
- scanf("%s", soft_recherche->rom);
- for(i=0; i<6; i++)
- {
- if (strcmp(soft_recherche->rom, soft_array[i].rom)==0)
- {
- j++;
- hist_soft[k]=soft_array[i];
- k++;
- }
- }
- }
- if(rep==4)
- {
- printf("Saisir la puissance graphique necessaire souhaitee\n");
- scanf("%s", soft_recherche->puis_graph);
- for(i=0; i<6; i++)
- {
- if (strcmp(soft_recherche->puis_graph, soft_array[i].puis_graph)==0)
- {
- j++;
- hist_soft[k]=soft_array[i];
- k++;
- }
- }
- }
- if(rep==5)
- {
- printf("Saisir la puissance processeur necessaire souhaitee\n");
- scanf("%s", soft_recherche->puis_proc);
- for(i=0; i<6; i++)
- {
- if (strcmp(soft_recherche->puis_proc, soft_array[i].puis_proc)==0)
- {
- j++;
- hist_soft[k]=soft_array[i];
- k++;
- }
- }
- }
- if (j!=0) printf("Nous avons trouve %d fois votre config\n", j);
- system("PAUSE");
- demande_soft(hist_soft, soft_recherche, nv_soft, k+1);
- }
- int main(){
- system("mode con lines=45 cols=180");
- int sz_proco=8;
- int sz_graphic=6;
- int sz_motherboard=10;
- int sz_soft=6;
- int sz_hdd=9;
- int sz_ram=18;
- int sz_ecran=9;
- processeur proco_array[11];
- Ram ram_array[18];
- Motherboard motherboard_array[10];
- Graphics graphic_array[6];
- Soft soft_array[6];
- caracEcran ecran_array[9];
- Hdd hdd_array[9];
- processeur proco_recherche;
- Ram ram_recherche;
- Motherboard motherboard_recherche;
- Graphics graphic_recherche;
- Soft soft_recherche;
- caracEcran ecran_recherche;
- Hdd hdd_recherche;
- Soft hist_soft[6];
- processeur hist_proco[11];
- Ram hist_ram[18];
- Graphics hist_graphic[6];
- Motherboard hist_motherboard[10];
- Hdd hist_hdd[9];
- caracEcran hist_ecran[9];
- int choix;
- do
- {
- system("cls");
- printf("Bienvenue dans l'outil de comparaison de componsants informatiques\n");
- printf("Nous proposons de nombreux composants, faites donc vos choix et remplissez uniquement les categories si vous connaissez les references \n");
- printf("Veuillez choisir parmis la liste de composants suivants : \n");
- printf("1) Carte mere\n");
- printf("2) Processeur\n");
- printf("3) RAM\n");
- printf("4) Carte Graphique\n");
- printf("5) Disque Dur\n");
- printf("6) Ecran\n");
- printf("7) Logiciel\n\n");
- printf("0) Quitter\n\n");
- scanf("%d", &choix);
- switch(choix)
- {
- case 1:
- ouverture_motherboard(motherboard_array);
- demande_motherboard(motherboard_array, &motherboard_recherche, hist_motherboard, sz_motherboard);
- break;
- case 2:
- ouverture_proco(proco_array);
- demande_proco(proco_array, &proco_recherche, hist_proco, sz_proco);
- break;
- case 3:
- ouverture_ram(ram_array);
- demande_ram(ram_array, &ram_recherche, hist_ram, sz_ram);
- break;
- case 4:
- ouverture_graphics(graphic_array);
- demande_graphics(graphic_array, &graphic_recherche, hist_graphic, sz_graphic);
- break;
- case 5:
- ouverture_hdd(hdd_array);
- demande_hdd(hdd_array, &hdd_recherche, hist_hdd, sz_hdd);
- break;
- case 6:
- ouverture_Ecran(ecran_array);
- demande_ecran(ecran_array, &ecran_recherche, hist_ecran, sz_ecran);
- break;
- case 7:
- ouverture_soft(soft_array);
- demande_soft(soft_array, &soft_recherche, hist_soft, sz_soft);
- break;
- default:
- if(choix!=0) {printf("Recommencez, ce choix n'est pas disponible (pas encore!)\n"); system("PAUSE");}
- break;
- }
- }
- while (choix!=0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement