Source Code
Problem: 1005 | User: cug_fish2008 | |
Memory: 292K | Time: 0MS | |
Language: C++ | Result: Accepted |
- Source Code
#include <iostream> using namespace std; class Node { public: Node(){x=y=0.0;} public: float x; float y; Node *next; }; int main() { int n; cin>>n; Node *start,*pass; pass=new Node; start=pass; float mx,my; for(int i=0;i<n;i++) { cin>>mx>>my; if(my<0.0)return 0; pass->x=mx;pass->y=my; pass->next=new Node; pass=pass->next; } for(int i=1;i<=n;i++) { int z; z=int(((start->x*start->x+start->y*start->y)*3.1415926)/100); z++; cout<<"Property "<<i <<": This property will begin eroding in year " <<z<<"."<<endl; start=start->next; } cout<<"END OF OUTPUT."; return 0; }