Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.84 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. struct combinacao
  6. {
  7.     string nomeCor;
  8.     string cor1;
  9.     string cor2;
  10.     string tipo;
  11. };
  12.  
  13. int main()
  14. {
  15.     //cores usadas          cor gerada          tipo da cor
  16.     string combinacoes[9][4] = {"yellow",   "orange",   "yellow-orange",    "tertiary",
  17.                                 "red",      "orange",   "red-orange",       "tertiary",
  18.                                 "red",      "violet",   "red-violet",       "tertiary",
  19.                                 "blue",     "violet",   "blue-violet",      "tertiary",
  20.                                 "blue",     "green",    "blue-green",       "tertiary",
  21.                                 "yellow",   "green",    "yellow-green",     "tertiary",
  22.                                 "blue",     "yellow",   "green",            "secondary",
  23.                                 "yellow",   "red",      "orange",           "secondary",
  24.                                 "red",      "blue",     "violet",           "secondary"
  25.                                };
  26.     combinacao cor[9];
  27.     for (int i = 0; i < 9; i++)
  28.     {
  29.         for (int j = 0; j < 4; j++)
  30.         {
  31.             cor[i].nomeCor = combinacoes[i][2];
  32.             cor[i].cor1    = combinacoes[i][1];
  33.             cor[i].cor2    = combinacoes[i][0];
  34.             cor[i].tipo    = combinacoes[i][3];
  35.         }
  36.     }
  37.     string cor1, cor2;
  38.     // ======= edite a partir daqui =======
  39.     cout<< "Digite a primeira cor: ";
  40.     cin>>cor1;
  41.     cout<< "Digite a segunda cor: ";
  42.     cin>>cor2;
  43.  
  44.     for(int i=0; i<9; i++)
  45.     {
  46.         if(cor[i].cor1 ==cor1 && cor[i].cor2 == cor2)
  47.         {}
  48.             else if(cor[i].cor1 == cor2 && cor[i].cor2 == cor1)
  49.             {
  50.                 cout << "A combinação gera a cor:" << cor[i].nomeCor << endl;
  51.                 cout << "A combinação gerada eh do tipo:"<<cor[i].tipo << endl;
  52.             }
  53.         }
  54.     return 0;
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement