1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#include <iostream>
using namespace std;
const int SIZEVECT = 10;
int produitScalaire(int [], int []);
int main()
{
int v[SIZEVECT] = {0,0,2,-2,-2,-2,-1,2,2,-3};
int d[6*SIZEVECT] = {-1,0,0,1,1,-1,0,-3,3,-2,-2,-1,-2,0,-1,3,3,-3,2,-1,0,0,3,0,3,-1,1,1,0,1,1,-2,-2,3,-2,-3,0,2,1,-2,-1,0,3,-2,2,1,-1,-2,0,0,-2,1,-2,-1,1,-1,-1,1,-1,2};
int y[SIZEVECT];
bool r[SIZEVECT];
int valeur_PS;
for (int vector_no = 0; vector_no < 6; vector_no++)
{
for (int element_no = 0; element_no < SIZEVECT; element_no++)
{
y[element_no] = d[((vector_no) * 10) + element_no];
}
valeur_PS = produitScalaire(v, y);
if (valeur_PS = 0)
{
r[vector_no] = true;
}
else
{
r[vector_no] = false;
}
for (int i = 0; i < SIZEVECT; i++)
{
cout << r[i] << "\t";
}
cout << "\n" << endl;
}
return 0;
}
int produitScalaire(int v[], int y[])
{
int valeur_PS;
for (int elementPS_no = 0; elementPS_no < SIZEVECT; elementPS_no++)
{
valeur_PS = valeur_PS + (v[elementPS_no] * y[elementPS_no]);
}
return valeur_PS;
}
|