Quick actions

cmd+k|ctrl+k

Navigation

Languages

lab6-89

Snippet info

Language

Cpp

Visibility

public

Author

matho.camara

Created

2018-11-28T10:51:13Z

Updated

2018-12-12T09:14:24Z

#include <iostream>
using namespace std;

int main() {
    int n,counter=20;
    bool equals=false;
    
    cout << "Input the fist element of the sequence :"<<endl;
    cin>>n;
    
    for(int i=0,j=n;i<20,j<=n+20;i++,j++)
    {
        //showing the content
        cout<<endl;
        cout<<j<<endl;
        ////////////////////
        if(i+1<20)
        {
            if(j==j+1)
            {
                equals=true;
                break;
            }
             else
            {
                equals=false;
            }
        }
       
    }
    
    if(equals)
        cout<<"the elements of the given sequence are equals !"<<endl;
    else
        cout<<"the elements of the given sequence are not equals !"<<endl;
        
        int *massive = new int[20];
        for(int i = 0; i<20; i++)
        {
            cin >> massive[i];
        }
        
        bool r = true;
        for(int i = 0; i<20; i++)
        {
            for(int j = 0; j<20; i++)
            {
                if(!massive[i] == massive[j])
                {
                    r = false;
                    break;
                }
            }
            if(r == false) break;
            
        }
        if(r)
            cout<<"the elements of the given sequence are equals !"<<endl;
        else
            cout<<"the elements of the given sequence are not equals !"<<endl;
        
    return 0;
    
}
INFO