Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. Problema 4 (aproape completa)
  2.  
  3. // { , } < >
  4. #include <iostream>
  5. #include <fstream>
  6. using namespace std;
  7. unsigned int V[10],n;
  8. int main()
  9. void interschimbare(unsigned int V[10],unsigned int n)
  10. {
  11. unsigned int min,max,aux,i,p,q:
  12. min=V[1];
  13. max=V[1];
  14. for(i=1;i<=1;i++){
  15. if(V[1]<min){min=V[i];
  16. p=i;
  17. }
  18. if(V[i]>max){max=V[i];
  19. q=i;
  20. }
  21. }
  22. aux=V[p];V[p]=V[q];V[q]=aux;
  23. for(i=1;i<=1;i++)cout<<V[i]<<" ";
  24. }
  25. unsigned int cifra_control(int n)
  26. {
  27. unsigned int S=0;
  28. while(n!=0){
  29. S=S+n%10;
  30. n=n/10;
  31. }
  32. while(S>=10){n=S;S=0;
  33. while (n!=0) {S=S+n%10;
  34. n=n/10;
  35. return S;}
  36. }
  37. }
  38. int main ()
  39. {
  40. ifstream f(atestat.in);
  41. ofstream g(atestat.out);
  42. for(i=1;i =n;i++)f>>V
  43.  
  44. Problema 5 (aproape completa)
  45.  
  46. #include <iostream>
  47. #include <fstream>
  48. using namespace std;
  49. unsigned int n;
  50. void suma_cif(int n,int V[10])
  51. {
  52. int i, S=0, max;
  53. x=V[1];
  54. for(i=1;i<=n;i++)if(V[i]>max)max=V[i];
  55. while(S!=0){S=S+max%10;
  56. max=max/10;
  57. }
  58. cout<<S;
  59. }
  60. int ordine(int n)
  61. {
  62. int a=0;
  63. while ((n!=0)&&(a==0))if(n%10<n/10%10){a=1;n=n/10;}
  64. if(a==0)return 1;
  65. else return 0
  66. }
  67. int main()
  68. {
  69. int i;
  70. ifstream f(})
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement