blob: a2810a60e0d4e79b662ab5a362e4b7a767a74b40 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include <iostream>
using namespace std;
void swap (int &a, int &b);
int main(int argc, char* argv[]) {
if (argc !=2) {
cout << "Incorrect number of arguments! USAGE:" << endl
<< " swappy <string>" << endl;;
return 3;
}
int i;
for (i=0; i<10000; i++) {
if (argv[1][i]=='\0') {
break;
}
}
swap(argv[1][0],argv[1][(i-1)]);
cout << argv[1] << endl;
}
void swap (char &a, char &b) {
char temp;
temp=a; a=b; b=temp;
}
|