Advertisement
catalyn

problema 8.10.2014

Oct 8th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void citeste(int v[100],int &n)//f(int n)-parametru transmis prin valoare (e copia lui)
  6. //f(&n)-parametru transmis prin referinta(e el insusi
  7.  
  8. {int i;
  9. cout<<"n=";
  10. cin>>n;
  11. for(i=1;i<=n;i++)
  12. {
  13. cout<<"v["<<i<<"]=";
  14. cin>>v[i];
  15. }
  16.  
  17. }
  18. int sub(int v[101],int n,int a)
  19. {
  20. int i,k=0;
  21. for(i=1;i<=n;i++)
  22. if(v[i]<a)
  23. k++;
  24.  
  25.  
  26. }
  27. int fv[100];
  28. void rezolva(int v[100],int n)
  29. {
  30. int i,ok=1,x;
  31. for(i=1;i<=n && ok==1;i++)
  32. {
  33. x=sub(v,n,v[i]);
  34. fv[x]++;
  35. if(fv[x]==2)
  36. ok=0;
  37. }
  38. if(ok==1)
  39. cout<<"da";
  40. else
  41.  
  42. cout<<"nu";
  43. }
  44. int main()
  45. {
  46. int v[100],n;
  47. citeste (v,n);
  48. rezolva(v,n);
  49. return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement