Untitled

mail@pastecode.io avatar
unknown
c_cpp
a month ago
657 B
1
Indexable
Never
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    vector <int> numbers={5,3,8,1,2};
    sort(numbers.begin(),numbers.end());
    for(int i : numbers)
       cout<<i<<" ";
    cout<<"Vektori i permbysur eshte "<<endl;
    reverse(numbers.begin(),numbers.end());
    for(int i : numbers)
       cout<<i<<" ";
    cout<<"Cfare numer doni te gjeni?"<<endl;
    int num;
    cin>>num;
    auto indeksi = find(numbers.begin(),numbers.end(),num);
    if(indeksi==numbers.end())
    cout<<"Numri "<<num<<" nuk ndodhet ne vektor"<<endl;
    else
    cout<<"Numri "<<num<<" ndodhet ne vektor"<<endl;
    
    return 0;
}
Leave a Comment