Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- struct point
- { float x,y,z;
- };
- double dlina (point a)
- { return sqrt(a.x*a.x+a.y*a.y+a.z*a.z);}
- int main()
- { point a[100];
- int n;
- cout<<"Vvedite n";
- cin>>n;
- for (int i=0; i<n; i++)
- {cout<<"Vvedite koordinatu"<<i<<"ot tochki";
- cin>>a[i].x>>a[i].y>>a[i].z;}
- double max=0; int k=0;
- for (int i=0; i<n; i++)
- if (dlina (a[i])>max)
- {max=dlina(a[i]);
- k=i;}
- cout<<"k="<<k;
- system("PAUSE");
- return 0; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement