codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <iostream> using namespace std; int main() { double A[2][10]; double x_arr[] = {1,2,3,4,10,6,4,8,9,-1}; double y_arr[] = {1,2,3,4,10,6,5,8,9,-1}; memcpy(&A[0], x_arr, sizeof(x_arr)); memcpy(&A[1], y_arr, sizeof(y_arr)); int nPoint = sizeof(A)/(2*sizeof(A[0][0])); bool bLine = true; for(int i = 0; (i < nPoint) && bLine; i++) { cout<<"POINT # "<<i<<" ("<<A[0][i]<<";"<<A[1][i]<<") :\t"; bLine = false; if(A[0][i]) if(A[1][i] / A[0][i] == A[1][0] / A[0][0])//Как раз проверка угловых коэффициентов bLine = true; if(!bLine) cout<<"Point not lie in one line"<<endl; else cout<<"Point is in one line with previous points"<<endl; } return 0; }
Private
[
?
]
Run code
Submit