Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <conio.h>
- using namespace std;
- /*
- Napisz funkcję, która dla zmiennej typu string zwraca łańcuch w odwrotnej kolejności znaków (odwraca łańcuch), zmienną należy przekazać przez referencję (funkcja typu void);
- wykorzystać funkcje z biblioteki STL; sprawdzić działanie funkcji;
- */
- void odwroc(string &fuck)
- {
- int length = fuck.length();
- for (int i=0; i<(length/2); i++)
- {
- swap(fuck[i], fuck[length-1]);
- length--;
- }
- }
- int main()
- {
- string shit = "1234567";
- odwroc(shit);
- cout << "odwrocone gowno to: " << shit << endl;
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment