,   CyberForum.ru

(++) - C++


 
C++ http://www.cyberforum.ru/cpp-beginners/thread224468.html
, (), . #include...
C++ ++ ? ++ ? , - , ). ... http://www.cyberforum.ru/cpp-beginners/thread224466.html
C++ cos ???
y, cos(x) . -2 2 0,5. . y=cos(x/2)/cos(x^2), x y=cos^2(x/2)*(cos2x), x > 0
C++
:c->data=d;? ! : struct node { int data; }; void main () { int d=5,i=0;
C++ c a b http://www.cyberforum.ru/cpp-beginners/thread224454.html
))) . : a b. c a b , a, b. ...
C++ . : =|aij|, i,j=1,2...n. aij=f(i,j)=(|j-3|-1,3)(6,5-j) + 2(3,3^(-i) - 1,5). ...

kiberg
0 / 0 / 0
: 29.12.2010
: 8
07.01.2011, 16:50  []
kiberg
:
, , : 1.) , 2.) ( ), 3.) . .
: http://www.neive.by.ru/geometriia/pr...zadatcha5.html : http://***************/question/20365534/

, . - :
C++
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*  struct.h: */
#pragma once
 
struct Point2D
{
   double x, y;
};
 
struct Line2D
{
   double x, y;
   double A, B, C;
};
 
 
/*  Unit1.cpp: */
#include <vcl.h>
#include <iostream.h>
#include <conio.h>
#include "struct.h"
 
 
int main()
{
Point2D point;
Line2D line;
 
cout << "Zadayte koordinaty tochki (x, y)\n";
cout << "Vvedite x koordinatu tochki ";
cin >> point.x;
cout << "Vvedite y koordinatu tochki ";
cin >> point.y;
cout << "Zadayte koefficienty v uravnenii pryamoy A*x + B*y + C = 0\n";
cout << "Vvedite A koefficient pryamoy ";
cin >> line.A;
cout << "Vvedite B koefficient pryamoy ";
cin >> line.B;
cout << "Vvedite C koefficient pryamoy ";
cin >> line.C;
 
//ïðîâåðÿåì ÷òî îá* êîýô. â óð-èè ïðÿìîé *å=0
if ((line.A == 0) && (line.B == 0))
  {
  cout << "Nekorrektniy vvod";
  getch();
  return 0;
  }
 
double M, N, L;
double b;
 
//ñëó÷*é åñëè êîýôôèöèå*ò ïðè x=0 èëè îá* êîýôôèöèå*ò* *å=0 (ò.å. *îðì*ëü*ûé ñëó÷*é)
if( line.A == 0 || ((line.A != 0) && (line.B != 0)) )
{
 
//line.y = -M*line.x - L; - Âûð*çèì ó â óð*â*å*èè ïðÿìîé, ãäå M = (line.A / line.B);
//Òåîðåì*. Ïóñòü ä**û äâå ïðÿìûå  a è b è èçâåñò*û èõ óð*â*å*èÿ ó=kx+b è y2=k2x+b2.
//         È åñëè ïðÿìûå a è b ïåðïå*äèêóëÿð*û, òî k = -1 / k2
 
// â ñëó÷*å åñëè êîýô. ïðè õ=0, òî N=0
if (line.A == 0)
  N = 0; //ò.ê. N = (line.B / line.A) = 0
else
  N = (line.B / line.A);
 
  M = (line.A / line.B);
  L = (line.C / line.B);
 
//ïîäñò*âëÿåì êîîðäè**òû òî÷êè âî 2-îå óð-èå è **õîäèì êîýô. b
//line.y2 =  N*line.x + b
b = point.y - N*point.x;
 
//èç 2-óõ ïîëó÷å**ûõ óð-èé **õîäèì x è y - ýòî êîîðäè**òû ïðîåêöèè
//ïðèð*â*èâ*åì ïð*âûå ÷*ñòè óð-èé: line.y = -M*line.x - L  è  line.y =  N*line.x + b
//N*line.x + b + M*line.x + L = 0
//(N + M)*line.x = - L - b
//òîãä* line.x = (- L - b) / (N + M)
if((N + M) == 0)
  line.x = point.x;
else
  line.x = (- L - b) / (N + M);
 
line.y = -M*line.x - L;
}
 
 
//ñëó÷*é åñëè êîýôôèöèå*ò ïðè y = 0
if( line.B == 0 )
{
 
//line.x = -M*line.y - L; - Âûð*çèì x â óð*â*å*èè ïðÿìîé, ãäå M = (line.B / line.A)
//Òåîðåì*. Ïóñòü ä**û äâå ïðÿìûå  a è b è èçâåñò*û èõ óð*â*å*èÿ x=ky+b è x2=k2y+b2.
//         È åñëè ïðÿìûå a è b ïåðïå*äèêóëÿð*û, òî k = -1 / k2
 
  N = 0; //ò.ê. N = (line.A / line.B) = 0
  M = 0; //ò.ê. M = (line.B / line.A) = 0
  L = (line.C / line.A);
 
//ïîäñò*âëÿåì êîîðäè**òû òî÷êè âî 2-îå óð-èå è **õîäèì êîýô. b
//line.x2 =  N*line.x + b
b = point.y - N*point.x;
 
//èç 2-óõ ïîëó÷å**ûõ óð-èé **õîäèì x è y - ýòî êîîðäè**òû ïðîåêöèè
//ïðèð*â*èâ*åì ïð*âûå ÷*ñòè óð-èé: line.x = -M*line.y - L  è  line.x =  N*line.y + b
//N*line.y + b + M*line.y + L = 0
//(N + M)*line.y = - L - b
//òîãä* line.y = (- L - b) / (N + M)
if((N + M) == 0)
  line.y = point.y;
else
  line.y = (- L - b) / (N + M);
 
line.x = -M*line.y - L;
}
 
cout << "\nProekciya tochki (" << point.x << ", " << point.y << ") " << "na pryamuyu " << line.A << "x";
if(line.B > 0) cout << "+";
cout << line.B << "y";
if(line.C > 0) cout << "+";
cout << line.C << "=0 - (" << line.x << ", " << line.y << ")";
 
getch();
return 0;
}
0
 
- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
@Mail.ru