黄昏孤酒

关注

c语言 向量点积

黄昏孤酒

关注

阅读 71

2022-02-11

在这里插入图片描述

#include <stdio.h>
#include <math.h>

typedef struct point {
    int x;
    int y;
} Vector;

int vector_dotprod(Vector v1, Vector v2) {
    
    return v1.x * v2.x + v1.y * v2.y;
}

int main() {
    
    Vector v1;
    Vector v2;
    int dotprod_result;

    scanf("%d%d", &(v1.x), &(v1.y));
    scanf("%d%d", &(v2.x), &(v2.y));

    dotprod_result = vector_dotprod(v1, v2);
	printf("%d", dotprod_result);
	
	return 0;
}

相关推荐

MaxWen

向量点积(Dot Product),向量叉积(Cross Product)

MaxWen 94 0 0

梯梯笔记

矢量,点积,叉积

梯梯笔记 68 0 0

蛇发女妖

[Unity向量的点积Dot和简单光照的实现]

蛇发女妖 81 0 0

cwq聖泉寒江2020

07 点积

cwq聖泉寒江2020 50 0 0

Raow1

LeetCode题解(1570):两个稀疏向量的点积(Python)

Raow1 59 0 0

WikongGuan

高等数学:对向量及其线性运算和数量积、向量积的见解

WikongGuan 125 0 0

闲鱼不咸_99f1

信息学奥赛一本通(C++)在线评测系统——基础(一)C++语言——1108:向量点积计算

闲鱼不咸_99f1 29 0 0

hoohack

C# 已知点和向量,求距离的点

hoohack 11 0 0

phpworkerman

(线代)向量內积性质的证明:( α + β ) ² ≤ ( α , α ) ( β , β )

phpworkerman 151 0 0

A邱凌

高中数学:平面向量-数量积(向量与向量的乘积)与投影

A邱凌 7 0 0

精彩评论(0)

0 0 举报