Advertisement
Guest User

problem1.cpp

a guest
Feb 17th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. typedef struct coordinates{
  8.     int x;
  9.     int y;
  10.     int device;
  11. }Coordinates;
  12.  
  13. typedef struct pairs{
  14.     int source_device;
  15.     int target_device;
  16. }Pairs;
  17.  
  18. int n_places;
  19. int n_devices;
  20. int n_colliders;
  21.  
  22.  
  23.  
  24. void main_function(int devices, int index){
  25.    
  26. }
  27.  
  28. int main(){
  29.     int i;
  30.     int x;
  31.     int y;
  32.     int source_device;
  33.     int target_device;
  34.  
  35.     cin >> n_places;
  36.  
  37.     Coordinates coordinates_input[n_places];
  38.  
  39.     for (i=0;i<n_places;i++){
  40.         cin>>x>>y;
  41.         coordinates_input[i].x=x;
  42.         coordinates_input[i].y=y;
  43.     }
  44.    
  45.     cin>>n_devices>>n_colliders;
  46.     Pairs pairs_inputs[n_colliders];
  47.     int devices[n_devices];
  48.     for(i=0;i<n_devices;i++){
  49.         devices[i]=i+1;
  50.     }
  51.  
  52.     for(i=0;i<n_colliders;i++){
  53.         cin>>source_device>>target_device;
  54.         pairs_inputs[i].source_device=source_device;
  55.         pairs_inputs[i].target_device=target_device;
  56.  
  57.     }
  58.  
  59.     cout<<"Coordinates: "<<endl;
  60.     cout<<" "<<endl;
  61.  
  62.     for(i=0;i<n_places;i++){
  63.         cout<< coordinates_input[i].x<<" "<<coordinates_input[i].y<<endl;
  64.     }
  65.  
  66.     cout<<" "<<endl;
  67.     cout<<"End of Coordinates"<<endl;
  68.     cout<<" "<<endl;
  69.     cout<<"Pairs of Source and Targets: "<<endl;
  70.     cout<<" "<<endl;
  71.  
  72.     for(i=0;i<n_colliders;i++){
  73.         cout<< pairs_inputs[i].source_device<<" "<<pairs_inputs[i].target_device<<endl;
  74.     }
  75.     cout<<" "<<endl;
  76.  
  77.     cout<<"End of Pairs of Source and Targets"<<endl;
  78.     cout<<" "<<endl;
  79.  
  80.     return 0;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement