Untitled
unknown
c_cpp
a year ago
533 B
14
Indexable
#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;
}
Editor is loading...
Leave a Comment