Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.45 KB | None | 0 0
  1. //
  2. //  main.cpp
  3. //  exo1-TP1
  4. //
  5. //  Created by Dylan BUTELLE on 30/01/2020.
  6. //  Copyright © 2020 Dylan BUTELLE. All rights reserved.
  7. //
  8.  
  9. #include <iostream>
  10. #include <array>
  11. using namespace std;
  12. int main(){
  13.     int exemplaires=0,CA=0;
  14.     const int VOITURES=4;
  15.     const int VENDEURS=5;
  16.     array<array<int,VOITURES>,VENDEURS>ventes;
  17.     array<int,VOITURES>prix;
  18.     prix[0]=11000;
  19.     prix[1]=16000;
  20.     prix[2]=14000;
  21.     prix[3]=20000;
  22.     for(int i=0;i<VENDEURS;i++)
  23.     {
  24.         cout<<"Entrer les ventes du vendeur no "<<i+1<<" dans l'ordre des modèles : "<<endl;
  25.         for(int j=0;j<VOITURES;j++)
  26.         {
  27.            
  28.             cin>>ventes[i][j];
  29.         }
  30.     }
  31.     for(int i=0;i<VENDEURS;i++)
  32.     {
  33.         cout<<endl;
  34.         for(int j=0;j<VOITURES;j++)
  35.         {
  36.            
  37.             cout<<ventes[i][j]<<"\t";
  38.         }
  39.     }
  40.     cout<<endl;
  41.     for(int j=0;j<VOITURES;j++)
  42.        {
  43.            exemplaires=0;
  44.            
  45.            for(int i=0;i<VENDEURS;i++)
  46.            {
  47.                exemplaires+=ventes[i][j];
  48.                
  49.            }
  50.            cout<<"Modèle no "<<j+1<<" : "<<exemplaires<<endl;
  51.            
  52.        }
  53.     for(int i=0;i<VENDEURS;i++)
  54.     {
  55.         CA=0;
  56.         cout<<endl;
  57.         for(int j=0;j<VOITURES;j++)
  58.         {
  59.            
  60.             CA+=ventes[i][j]*prix[j];
  61.         }
  62.         cout<<"Chiffre d'affaire no "<<i+1<<" = "<<CA<<endl;
  63.     }
  64.     return 0;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement