#include <stdio.h>
#define N 3
void input(double *v){/***ベクトルに値を代入する関数***/
int i;
for(i=0;i<N;i++){
}
}
void print(double *v){/***ベクトルを表示する関数***/
int i;
for(i=0;i<N;i++)
}
double inner_product(double *a, double *b){/***内積を求める関数***/
int i;
double p=0.0;
for(i=0;i<N;i++)
p+=a[i]*b[i];
return(p);
}
void exterior_product(double *c, double *a, double *b){/***外積を求める関数***/
c[0]=a[1]*b[2]-a[2]*b[1];
c[1]=a[2]*b[0]-a[0]*b[2];
c[2]=a[0]*b[1]-a[1]*b[0];
}
int main(void){
double a[N],b[N],c[N];
input(a);/***ベクトルaを入力***/
input(b);/***ベクトルbを入力***/
print(a);/***ベクトルaを表示***/
print(b);/***ベクトルbを表示***/
printf("内積: %f\n",inner_product
(a
,b
));/***内積を求めて表示***/
exterior_product(c,a,b);/***外積を求める***/
print(c);/***配列dを表示***/
return(0);
}
ICNpbmNsdWRlIDxzdGRpby5oPgogI2RlZmluZSBOIDMKICAKIHZvaWQgaW5wdXQoZG91YmxlICp2KXsvKioq44OZ44Kv44OI44Or44Gr5YCk44KS5Luj5YWl44GZ44KL6Zai5pWwKioqLwogICBpbnQgaTsKICAgZm9yKGk9MDtpPE47aSsrKXsKICAgICBwcmludGYoIuODmeOCr+ODiOODq+OCkuWFpeWKm+OBl+OBpuOBj+OBoOOBleOBhCIpOyAKICAgICBzY2FuZigiJWxmIiwmdltpXSk7CiAgIH0KIH0KICAKIHZvaWQgcHJpbnQoZG91YmxlICp2KXsvKioq44OZ44Kv44OI44Or44KS6KGo56S644GZ44KL6Zai5pWwKioqLwogICBpbnQgaTsKICAgcHJpbnRmKCIoIik7CiAgIGZvcihpPTA7aTxOO2krKykKICAgICBwcmludGYoIiUuMWYgIix2W2ldKTsKICAgcHJpbnRmKCIpXG4iKTsKIH0KICAKIGRvdWJsZSBpbm5lcl9wcm9kdWN0KGRvdWJsZSAqYSwgZG91YmxlICpiKXsvKioq5YaF56mN44KS5rGC44KB44KL6Zai5pWwKioqLwogICBpbnQgaTsKICAgZG91YmxlIHA9MC4wOwogICBmb3IoaT0wO2k8TjtpKyspCiAgICAgcCs9YVtpXSpiW2ldOwogICByZXR1cm4ocCk7CiB9CiAgCiB2b2lkIGV4dGVyaW9yX3Byb2R1Y3QoZG91YmxlICpjLCBkb3VibGUgKmEsIGRvdWJsZSAqYil7LyoqKuWkluepjeOCkuaxguOCgeOCi+mWouaVsCoqKi8KICAgY1swXT1hWzFdKmJbMl0tYVsyXSpiWzFdOwogICBjWzFdPWFbMl0qYlswXS1hWzBdKmJbMl07CiAgIGNbMl09YVswXSpiWzFdLWFbMV0qYlswXTsKIH0KICAKIGludCBtYWluKHZvaWQpeyAKICAgZG91YmxlIGFbTl0sYltOXSxjW05dOwogICAKICAgaW5wdXQoYSk7LyoqKuODmeOCr+ODiOODq2HjgpLlhaXlipsqKiovCiAgIGlucHV0KGIpOy8qKirjg5njgq/jg4jjg6ti44KS5YWl5YqbKioqLwogICAKICAgcHJpbnRmKCJhPSIpOwogICBwcmludChhKTsvKioq44OZ44Kv44OI44OrYeOCkuihqOekuioqKi8KICAgCiAgIHByaW50ZigiYj0iKTsKICAgcHJpbnQoYik7LyoqKuODmeOCr+ODiOODq2LjgpLooajnpLoqKiovCiAgIAogICBwcmludGYoIuWGheepjTogJWZcbiIsaW5uZXJfcHJvZHVjdChhLGIpKTsvKioq5YaF56mN44KS5rGC44KB44Gm6KGo56S6KioqLwogIAogICBwcmludGYoIuWkluepjToiKTsgIAogICBleHRlcmlvcl9wcm9kdWN0KGMsYSxiKTsvKioq5aSW56mN44KS5rGC44KB44KLKioqLwogICBwcmludChjKTsvKioq6YWN5YiXZOOCkuihqOekuioqKi8KICAgCiAgIHJldHVybigwKTsKIH0K