Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace o
- {
- class Program
- {
- public static void Main(string[] args)
- {
- string[,] monTab2D = new string[6,5];
- int compteurtableau = 0;
- for(int iLig = 0; iLig < 6 ; iLig ++)
- {
- for(int iCol = 0; iCol < 5 ; iCol ++)
- {
- if(iCol == 0 && iLig == 0)
- {
- Console.WriteLine("XXXX");
- }
- else
- {
- if(iLig == 0 && (iCol >= 1 || iCol <= 4))
- {
- Console.WriteLine("Modèle de voiture");
- monTab2D[iLig,iCol] = Console.ReadLine();
- }
- else{
- if(iCol == 0 && (iLig >= 1 || iCol <= 5))
- {
- Console.WriteLine("Nom vendeur");
- monTab2D[iLig,iCol] = Console.ReadLine();
- }
- else
- {
- Console.WriteLine("Valeur ligne {0} colonne {1} vendeur {2} modèle {3}",iLig,iCol, monTab2D[iLig,0], monTab2D[0,iCol]);
- monTab2D[iLig,iCol] = Console.ReadLine();
- }
- }
- }
- }}
- Console.WriteLine("\t");
- for(int iLig = 0; iLig <6 ; iLig ++)
- {
- for(int iCol = 0; iCol <5 ; iCol ++, compteurtableau++)
- {
- Console.Write(" {0}\t", monTab2D[iLig, iCol]);
- if (compteurtableau == 4){
- Console.WriteLine();
- compteurtableau = -1;
- }
- }
- }
- Console.ReadKey();
- }
- }
- }
- ------------------------------------------------------------------------------------------------------------------------------------
- using System;
- namespace u
- {
- class Program
- {
- public static void Main(string[] args)
- {
- string[,] monTab2D = new string[,]{ { "", "twingo", "clio", "mégane", "vel satis" },
- { "andré", "0", "3", "2", "0" },
- { "ingemar", "2", "3", "0", "1"},
- { "jean-jérôme","1", "1", "1", "1"},
- { "Cindy", "5", "1", "0", "0"},
- { "Joey", "1", "1", "2", "0"}};
- int twingo = 0, clio = 0, megane = 0, velsatis = 0;
- string nombreT = "", nombreC = "", nombreM = "", nombreV = "";
- for (int iLig = 0; iLig < 6; iLig++)
- {
- for (int iCol = 0; iCol < 5; iCol++)
- {
- if (iCol == 1 && (iLig >= 1 || (iLig >= 1 && iLig <= 4)))
- {
- nombreT = monTab2D[iLig, iCol];
- twingo = twingo + int.Parse(nombreT);
- }
- else
- {
- if (iCol == 2 && (iLig >= 1 || (iLig >= 1 && iLig <= 4)))
- {
- nombreC = monTab2D[iLig, iCol];
- clio = clio + int.Parse(nombreC);
- }
- else
- {
- if (iCol == 3 && (iLig >= 1 || (iLig >= 1 && iLig <= 4)))
- {
- nombreM = monTab2D[iLig, iCol];
- megane = megane + int.Parse(nombreM);
- }
- else
- {
- if (iCol == 4 && (iLig >= 1 || (iLig >= 1 && iLig <= 4)))
- {
- nombreV = monTab2D[iLig, iCol];
- velsatis = velsatis + int.Parse(nombreV);
- }
- }
- }
- }
- }
- }
- //AFICHAGE VALEURS
- Console.WriteLine("Il y a eu {0} twingo de vendu",twingo);
- Console.WriteLine("Il y a eu {0} clio de vendu", clio);
- Console.WriteLine("Il y a eu {0} megane de vendu", megane);
- Console.WriteLine("Il y a eu {0} vel satis de vendu", velsatis);
- Console.ReadKey();
- }
- }
- }
- ------------------------------------------------------------------------------------------------------------------------
- using System;
- namespace u
- {
- class Program
- {
- public static void Main(string[] args)
- {
- string[,] monTab2D = new string[,]{ { "", "twingo", "clio", "mégane", "vel satis" },
- { "andré", "0", "3", "2", "0" },
- { "ingemar", "2", "3", "0", "1"},
- { "jean-jérôme","1", "1", "1", "1"},
- { "Cindy", "5", "1", "0", "0"},
- { "Joey", "1", "1", "2", "0"}};
- int twingo = 0, clio = 0, megane = 0, velsatis = 0;
- int andré = 0, ingemar = 0, jeanj = 0, cindy = 0, joey = 0;
- string nombreT = "", nombreC = "", nombreM = "", nombreV = "";
- string nombreAn = "", nombreIn = "", nombreJJ = "", nombreCi = "", nombreJo = "";
- string unPourTous;
- int tandré = 0, candré = 0, mandré = 0, vandré = 0;
- int tingemar = 0, cingemar = 0, mingemar = 0, vingemar = 0;
- int tjeanj = 0, cjeanj = 0, mjeanj = 0, vjeanj = 0;
- int tcindy = 0, ccindy = 0, mcindy = 0, vcindy = 0;
- int tjoey = 0, cjoey = 0, mjoey = 0, vjoey = 0;
- //for savoir qui a vendu combien de quoi
- for (int iLig = 0; iLig < 6; iLig++)
- {
- for (int iCol = 0; iCol < 5; iCol++)
- {
- if (iLig == 1 && (iCol >= 1 || (iCol >= 1 && iCol <= 4)))
- {
- nombreAn = monTab2D[iLig, iCol];
- andré = andré + int.Parse(nombreAn);
- }
- else
- {
- if (iLig == 2 && (iCol >= 1 || (iCol >= 1 && iCol <= 4)))
- {
- nombreIn = monTab2D[iLig, iCol];
- ingemar = ingemar + int.Parse(nombreIn);
- }
- else
- {
- if (iLig == 3 && (iCol >= 1 || (iCol >= 1 && iCol <= 4)))
- {
- nombreJJ = monTab2D[iLig, iCol];
- jeanj = jeanj + int.Parse(nombreJJ);
- }
- else
- {
- if (iLig == 4 && (iCol >= 1 || (iCol >= 1 && iCol <= 4)))
- {
- nombreCi = monTab2D[iLig, iCol];
- cindy = cindy + int.Parse(nombreCi);
- }
- else
- {
- if (iLig == 5 && (iCol >= 1 || (iCol >= 1 && iCol <= 4)))
- {
- nombreJo = monTab2D[iLig, iCol];
- joey = joey + int.Parse(nombreJo);
- }
- }
- }
- }
- }
- }
- }
- //for savoir combien de voiture on été vendu
- for (int iLig = 0; iLig < 6; iLig++)
- {
- for (int iCol = 0; iCol < 5; iCol++)
- {
- if (iCol == 1 && (iLig >= 1 || (iLig >= 1 && iLig <= 4)))
- {
- nombreT = monTab2D[iLig, iCol];
- twingo = twingo + int.Parse(nombreT);
- }
- else
- {
- if (iCol == 2 && (iLig >= 1 || (iLig >= 1 && iLig <= 4)))
- {
- nombreC = monTab2D[iLig, iCol];
- clio = clio + int.Parse(nombreC);
- }
- else
- {
- if (iCol == 3 && (iLig >= 1 || (iLig >= 1 && iLig <= 4)))
- {
- nombreM = monTab2D[iLig, iCol];
- megane = megane + int.Parse(nombreM);
- }
- else
- {
- if (iCol == 4 && (iLig >= 1 || (iLig >= 1 && iLig <= 4)))
- {
- nombreV = monTab2D[iLig, iCol];
- velsatis = velsatis + int.Parse(nombreV);
- }
- }
- }
- }
- }
- }
- //for qui a vendu quoi a combien d'exemplaire
- for (int iLig = 0; iLig < 6; iLig++)
- {
- for (int iCol = 0; iCol < 5; iCol++)
- {
- //ANDRé
- if (iLig == 1 && iCol == 1)
- {//ANDRé
- unPourTous = monTab2D[iLig, iCol];
- tandré = tandré + int.Parse(unPourTous);
- unPourTous = 0;
- }
- else
- {
- if (iLig == 1 && iCol == 2)
- {//ANDRé
- candré = candré + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 1 && iCol == 3)
- {//ANDRé
- mandré = mandré + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 1 && iCol == 4)
- {//ANDRé
- vandré = vandré + int.Parse(unPourTous);
- }
- //INGEMAR
- else
- {
- if (iLig == 2 && iCol == 1)
- {//ingemar
- tingemar = tingemar + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 2 && iCol == 1)
- {//ingemar
- cingemar = cingemar + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 2 && iCol == 1)
- {//ingemar
- mingemar = mingemar + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 2 && iCol == 1)
- {//ingemar
- vingemar = vingemar + int.Parse(unPourTous);
- }
- //JEAN J
- else
- {
- if (iLig == 3 && iCol == 1)
- {//JJ
- tjeanj = tjeanj + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 3 && iCol == 1)
- {//JJ
- cjeanj = cjeanj + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 3 && iCol == 1)
- {//JJ
- mjeanj = mjeanj + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 3 && iCol == 1)
- {//JJ
- vjeanj = vjeanj + int.Parse(unPourTous);
- }
- //CINDY
- else
- {
- if (iLig == 4 && iCol == 1)
- {//cindy
- tcindy = tcindy + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 4 && iCol == 1)
- {//cindy
- ccindy = ccindy + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 4 && iCol == 1)
- {//cindy
- mcindy = mcindy + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 4 && iCol == 1)
- {//cindy
- vcindy = vcindy + int.Parse(unPourTous);
- }
- else
- //JOEY
- {
- if (iLig == 5 && iCol == 1)
- {//joey
- tjoey = tjoey + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 5 && iCol == 2)
- {//joey
- cjoey = cjoey + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 5 && iCol == 3)
- {//joey
- mjoey = mjoey + int.Parse(unPourTous);
- }
- else
- {
- if (iLig == 5 && iCol == 4)
- {//joey
- vjoey = vjoey + int.Parse(unPourTous);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }}}}}}}}}}}}}
- //AFICHAGE VALEURS
- Console.WriteLine("Il y a eu {0} twingo de vendu",twingo);
- Console.WriteLine("Il y a eu {0} clio de vendu", clio);
- Console.WriteLine("Il y a eu {0} megane de vendu", megane);
- Console.WriteLine("Il y a eu {0} vel satis de vendu", velsatis);
- Console.WriteLine();
- Console.WriteLine("André a vendu {0} voiture",andré);
- Console.WriteLine("ingemar a vendu {0} voiture",ingemar);
- Console.WriteLine("Jean J a vendu {0} voiture",jeanj);
- Console.WriteLine("Cindy a vendu {0} voiture",cindy);
- Console.WriteLine("Joey a vendu {0} voiture",joey);
- Console.WriteLine();
- Console.WriteLine("André a vendu {0} twingo, {1} clio,{2} mégane et {3} vel satis",tandré,candré,mandré,vandré);
- Console.WriteLine("André a vendu {0} twingo, {1} clio,{2} mégane et {3} vel satis",tingemar,cingemar,mingemar,vingemar);
- Console.WriteLine("André a vendu {0} twingo, {1} clio,{2} mégane et {3} vel satis",tjeanj,cjeanj,mjeanj,vjeanj);
- Console.WriteLine("André a vendu {0} twingo, {1} clio,{2} mégane et {3} vel satis",tcindy,ccindy,mcindy,vcindy);
- Console.WriteLine("André a vendu {0} twingo, {1} clio,{2} mégane et {3} vel satis",tjoey,cjoey,mjoey,vjoey);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement