alsav22
5434 / 4829 / 442
Регистрация: 04.06.2011
Сообщений: 13,587
|
29.08.2012, 18:52
|
|
C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
| #include <iostream>
using namespace std;
void turn(char *c, int step, int size)
{
if(step < (size / 2))
{
char temp = c[step];
char temp2 = c[size-step-1];
c[step] = temp2;
c[size-step-1] = temp;
turn(c, ++step, size);
}
}
int main()
{
char str[] = "ABSDEFGHJ";
cout << str << endl;
turn(str, 0, strlen(str));
cout << str << endl;
system("pause");
return 0;
} |
|
1
|