Advertisement
Adrita

task 1( ds lab 3) 3rd sem

Jan 22nd, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t,j;
  6. cin>>t;
  7. for(j=0; j<t; j++)
  8. {
  9. int i,pos[100],a;
  10. for(i=0;; i++)
  11. {
  12. cin>>a;
  13. if(a>-1)
  14. pos[i]=a;
  15. else
  16. break;
  17. }
  18. int len=i;
  19. float num[100],ar[100];
  20. for(i=0; i<len; i++)
  21. {
  22. cin>>num[i];
  23. }
  24. for(i=0; i<len; i++)
  25. {
  26. ar[pos[i]-1]=num[i];
  27. }
  28. cout<<"Output is"<<endl;
  29. for(i=0; i<len; i++)
  30. cout<<ar[i]<<endl;
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement