Untitled

mail@pastecode.io avatar
unknown
c_cpp
5 days ago
533 B
1
Indexable
Never
#include <iostream>
#include <vector>

int main()
{
    std::vector< int > vec;
    int n = 1;
    int index = 1;

    while( n != 0 )
    {
        std::cout << "Liczba " << index << ": ";
        std::cin >> n;
        vec.push_back( n );

        ++index;
    }
    std::cout << "\n\n";

    vec.pop_back();

    std::cout << "Liczby w wektorze w odwroconej kolejnosci:\n";
    for( auto it = vec.end() - 1; it != vec.begin() - 1; --it )
    {
        std::cout << *it << ", ";
    }

    return 0;
}
Leave a Comment