orlandoju

Ejer11_tp3

Apr 12th, 2022
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. //Nombre:
  2. //TP N°:
  3. //EJ N°:
  4. // Comentarios:
  5.  
  6. #include <iostream>
  7. using namespace std;
  8.  
  9. int main(void){
  10.  
  11.        int i,n1,maxn;
  12.        bool ordenado=true;
  13.  
  14.     cout<< " Ingrese la cantidad de 8 numeros: "<<endl;
  15.     cout<<"--------------------"<<endl;
  16.     for (i = 0; i < 8; i++)
  17.     {
  18.         cin >> n1;
  19.         cout<<"--------------------"<<endl;
  20.         if(i==0)
  21.         {
  22.             maxn=n1;
  23.         }
  24.         else if( n1>=maxn ){
  25.                 n1=maxn;
  26.         }
  27.         else if(n1<maxn){
  28.             ordenado=false;
  29.         }
  30.         }
  31.         if(ordenado==false){
  32.         cout<< "Conjunto No Ordenado"<<endl;
  33.         }
  34.         else if(ordenado==true){
  35.         cout<<"--------------------"<<endl;
  36.         cout<< " Conjunto Ordenado "<<endl;
  37.         }
  38.  
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment