Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KTKadyshev
KadyshevKT
Commits
dc3d03e3
Commit
dc3d03e3
authored
Dec 26, 2021
by
KTKadyshev
Browse files
Add new file
parent
965f6fb2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Задача 1 Вариант 2/С++
0 → 100644
View file @
dc3d03e3
#include <iostream>
using namespace std;
#include <math.h>
int main()
{
int a[3][1],b[3][1];
float skalar, modulea, moduleb;
a[0][0]=2;a[1][0]=-1;a[2][0]=0;
b[0][0]=1;b[1][0]=3;b[2][0]=-1;
skalar=a[0][0]*b[0][0]+a[1][0]*b[1][0]+a[2][0]*b[2][0];
modulea=sqrt(a[0][0]*a[0][0]+a[1][0]*a[1][0]+a[2][0]*a[2][0]);
moduleb=sqrt(b[0][0]*b[0][0]+b[1][0]*b[1][0]+b[2][0]*b[2][0]);
float cosalpha =skalar/(modulea*moduleb);
cout <<"косинус между векторами a и b = " << cosalpha << endl;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment