{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

templates_examples_1onPage

# templates_examples_1onPage - swap >template

This preview shows pages 1–4. Sign up to view the full content.

היצקנופה Swap סופיט לכל הבוט T , הקתעה יאנב םירדגומ ורובעש רוטרפואו = לשמל : המגוד : היצקנופ swap template < typename T> void Swap(T& a, T& b) { T temp = a; a = b; b = temp; } הקתעה יאנב רוטרפוא = String s1, s2; Swap(s1,s2); int x = 5, y = 10; Swap(x,y);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
ךרעמ תקתעהל היצקנופ : המגוד : תויצקנופ template םיכרעמל template < class T> void CopyArray(T a[], T b[], size_t size) { for ( int i=0; i < size; ++i) a[i] = b[i]; } רוטרפוא = ךרעמ תספדהל היצקנופ : template < class T> void PrintArray(T *a, size_t n) { for ( int i = 0; i < n; ++i) cout << a[i] << endl; cout<< "\n" ; } רוטרפוא >>
המגוד : תיצקנופ quicksort template < class Comparable> void quicksort(Comparable a[], int left, int right){ if (left >= right) // array contains less than 2 elements return ; int last = left; for ( int i = left+1; i <= right; ++i) if (a[i] < a[left])

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

templates_examples_1onPage - swap >template

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document