Commit 355a003b by Patryk Czarnik

Pierwsze operacje wektora - nagłówki

parent 89ec311c
......@@ -2,6 +2,17 @@
#include "wektor.h"
int main() {
std::cout << "Początek programu\n";
Wektor w;
w.push_back(10);
w.push_back(11);
w.push_back(12);
std::cout << "Element nr 0: " << w.get(0) << '\n';
std::cout << "Element nr 2: " << w.get(2) << '\n';
w.set(2, 222);
std::cout << "Element nr 2: " << w.get(2) << '\n';
std::cout << '\n';
std::cout << "Koniec programu\n";
return 0;
}
......@@ -3,5 +3,23 @@
#include <iostream>
/** Tablica zmiennej długości zawierająca wartości int. */
class Wektor {
public:
Wektor();
~Wektor();
/** Dodanie nowego elementu na końcu. */
void push_back(int e);
/** Przypisanie nowej wartości na podanej pozycji. */
void set(int idx, int e);
/** Odczyt wartości spod podanej pozycji. */
int get(int idx);
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment