mirror of
https://github.com/szymon-jozef/ZUT-notatki.git
synced 2026-10-28 11:10:38 +01:00
bla bla
This commit is contained in:
21
uczelnia/2_semestr/programowanie/laby/lab12/zad4.cpp
Normal file
21
uczelnia/2_semestr/programowanie/laby/lab12/zad4.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <iostream>
|
||||
|
||||
template <typename T> void zamien(T &a, T &b) {
|
||||
T c = a;
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
|
||||
template <typename T> void zamiana_i_wyswietlenie(T &x, T &y) {
|
||||
zamien(x, y); // teraz x == 2, y == 1
|
||||
std::cout << x << ',' << y << std::endl;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int x = 2, y = 4;
|
||||
zamiana_i_wyswietlenie(x, y);
|
||||
double i = 2.5, j = 3.5;
|
||||
zamiana_i_wyswietlenie(i, j);
|
||||
std::string a = "hej", b = "ho";
|
||||
zamiana_i_wyswietlenie(a, b);
|
||||
}
|
||||
Reference in New Issue
Block a user