#include <stdio.h>
#define N 3
void input(double *v, int n){/***ベクトルに値を代入する関数***/
int i;
for(i=0;i<n;i++){
}
}
void print(const double *v, int n){/***ベクトルを表示する関数***/
int i;
for(i=0;i<n;i++)
}
double inner_product(const double *a, const double *b, int n){/***内積を求める関数***/
int i;
double p=0.0;
for(i=0;i<n;i++)
p+=a[i]*b[i];
return(p);
}
void exterior_product(double *c, const double *a, const 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,N);/***ベクトルaを入力***/
input(b,N);/***ベクトルbを入力***/
print(a,N);/***ベクトルaを表示***/
print(b,N);/***ベクトルbを表示***/
printf("内積: %f\n",inner_product
(a
,b
,N
));/***内積を求めて表示***/
exterior_product(c,a,b);/***外積を求める***/
print(c,N);/***配列dを表示***/
return(0);
}
ICNpbmNsdWRlIDxzdGRpby5oPgogI2RlZmluZSBOIDMKICAKIHZvaWQgaW5wdXQoZG91YmxlICp2LCBpbnQgbil7LyoqKuODmeOCr+ODiOODq+OBq+WApOOCkuS7o+WFpeOBmeOCi+mWouaVsCoqKi8KICAgaW50IGk7CiAgIGZvcihpPTA7aTxuO2krKyl7CiAgICAgcHJpbnRmKCLjg5njgq/jg4jjg6vjgpLlhaXlipvjgZfjgabjgY/jgaDjgZXjgYQiKTsgCiAgICAgc2NhbmYoIiVsZiIsJnZbaV0pOwogICB9CiB9CiAgCiB2b2lkIHByaW50KGNvbnN0IGRvdWJsZSAqdiwgaW50IG4pey8qKirjg5njgq/jg4jjg6vjgpLooajnpLrjgZnjgovplqLmlbAqKiovCiAgIGludCBpOwogICBwcmludGYoIigiKTsKICAgZm9yKGk9MDtpPG47aSsrKQogICAgIHByaW50ZigiJS4xZiAiLHZbaV0pOwogICBwcmludGYoIilcbiIpOwogfQogIAogZG91YmxlIGlubmVyX3Byb2R1Y3QoY29uc3QgZG91YmxlICphLCBjb25zdCBkb3VibGUgKmIsIGludCBuKXsvKioq5YaF56mN44KS5rGC44KB44KL6Zai5pWwKioqLwogICBpbnQgaTsKICAgZG91YmxlIHA9MC4wOwogICBmb3IoaT0wO2k8bjtpKyspCiAgICAgcCs9YVtpXSpiW2ldOwogICByZXR1cm4ocCk7CiB9CiAgCiB2b2lkIGV4dGVyaW9yX3Byb2R1Y3QoZG91YmxlICpjLCBjb25zdCBkb3VibGUgKmEsIGNvbnN0IGRvdWJsZSAqYil7LyoqKuWkluepjeOCkuaxguOCgeOCi+mWouaVsCoqKi8KICAgY1swXT1hWzFdKmJbMl0tYVsyXSpiWzFdOwogICBjWzFdPWFbMl0qYlswXS1hWzBdKmJbMl07CiAgIGNbMl09YVswXSpiWzFdLWFbMV0qYlswXTsKIH0KICAKIGludCBtYWluKHZvaWQpeyAKICAgZG91YmxlIGFbTl0sYltOXSxjW05dOwogICAKICAgaW5wdXQoYSxOKTsvKioq44OZ44Kv44OI44OrYeOCkuWFpeWKmyoqKi8KICAgaW5wdXQoYixOKTsvKioq44OZ44Kv44OI44OrYuOCkuWFpeWKmyoqKi8KICAgCiAgIHByaW50ZigiYT0iKTsKICAgcHJpbnQoYSxOKTsvKioq44OZ44Kv44OI44OrYeOCkuihqOekuioqKi8KICAgCiAgIHByaW50ZigiYj0iKTsKICAgcHJpbnQoYixOKTsvKioq44OZ44Kv44OI44OrYuOCkuihqOekuioqKi8KICAgCiAgIHByaW50Zigi5YaF56mNOiAlZlxuIixpbm5lcl9wcm9kdWN0KGEsYixOKSk7LyoqKuWGheepjeOCkuaxguOCgeOBpuihqOekuioqKi8KICAKICAgcHJpbnRmKCLlpJbnqY06Iik7ICAKICAgZXh0ZXJpb3JfcHJvZHVjdChjLGEsYik7LyoqKuWkluepjeOCkuaxguOCgeOCiyoqKi8KICAgcHJpbnQoYyxOKTsvKioq6YWN5YiXZOOCkuihqOekuioqKi8KICAgCiAgIHJldHVybigwKTsKIH0K