Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. int i = 0;
  2.  
  3. int ii = 0;
  4.  
  5. int j = 0;
  6.  
  7. int jj = 0;
  8.  
  9. int band = 0;
  10.  
  11. int encontrado = 0;
  12.  
  13. int* numeros = NULL;
  14.  
  15. int* nrepetidos = NULL;
  16.  
  17. int n = 0;
  18.  
  19. cout<<"Conocer la cantidad de numeros y ordenarlos"<<endl;
  20.  
  21. cout<<endl;
  22.  
  23. cout<<"ingrese la cantidad de numeros que se usaran";
  24.  
  25. cin>>n;
  26.  
  27. for(i=0;i<n;i=i+1){
  28. cout<<"numero"<<i<<". ";
  29. cin>>numeros[i];
  30. }
  31. for(i=0;i<n;i=i+1){
  32. for(j=0;j<n;j=j+1){
  33. if(numeros[j]<<numeros[j+1]){
  34. band = numeros[i];
  35. numeros[j] = numeros[j+1];
  36. numeros[j] = band;
  37. }
  38.  
  39. }
  40. }
  41. for(ii=0;ii<n;ii=ii++){
  42. if (nrepetidos[ii]=0)
  43. numeros[ii]= nrepetidos[ii];
  44.  
  45. else{
  46.  
  47. for(jj=0;jj<n;jj++){
  48. if(numeros[ii]= nrepetidos[jj]){encontrado = 1;
  49. }
  50. if(encontrado=0);{
  51. numeros[ii] = nrepetidos[jj];
  52. }
  53. }
  54. }
  55. }
  56. for(i=0;i<n;i=i+1){
  57. }
  58. cout<<"Los numeros quedaran odenados de la siguiente manera: "<<nrepetidos<<endl;
  59. system ("PAUSE");
  60.  
  61. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement