PPProject ์ฒซ ๋ฒ์งธ ๋ง๋จ์ ๊ฒฐ๊ณผ๋ฌผ
1. ๋ฌธ์ ¶
์ปฌ๋ผ 2. B๋ฒ ๋ฌธ์
n๊ฐ์ ์์๋ฅผ ๊ฐ์ง๋ 1์ฐจ์ ๋ฒกํฐ๋ฅผ i๋งํผ ์ผ์ชฝ์ผ๋ก ํ์ ์์ผ๋ผ.
n๊ฐ์ ์์๋ฅผ ๊ฐ์ง๋ 1์ฐจ์ ๋ฒกํฐ๋ฅผ i๋งํผ ์ผ์ชฝ์ผ๋ก ํ์ ์์ผ๋ผ.
1.1. Leonardong ¶
~cpp
#include <iostream>
#include <string>
using namespace std;
void roll( string str, int i );
void main()
{
string str = "abcde";
int i = 3;
roll(str, i);
}
void roll( string str, int i )
{
cout << str << endl;
int n = str.length();
char temp;
for ( int tag = 0 ; tag < n ; tag++ ){
temp = str[tag];
str[tag] = str[i-1];
str[i-1] = temp;
i = i < n ? i+1 : i;
}
cout << str << endl;
}
1.2. ์ฌ์ ํ์ ¶
~cpp
#include<iostream.h>
#include<cstring>
void roll(int i);
char * string="ABCDEFGHIJKLMNOPQRSTUV";
const int SIZE = strlen(string);
void main()
{
roll(4);
}
void roll(int i)
{
char* buffer1 = new char[i];
strncpy(buffer1, string, i);
buffer1[i] = 0;
char *buffer2 = new char[SIZE-i];
strcpy(buffer2,string+i);
cout<<strcat(buffer2,buffer1)<<endl;
}
2. ํ๊ธฐ ¶
์ฌ์ :
์ฒซ ๋ชจ์์ด๋ผ ์คํฐ๋ ๋ฐฉ์์ ์ ํ๋๋ฐ ์๊ฐ์ด ์ค๋ ๊ฑธ๋ ธ๋ค. ํ์์ด์ PairProgramming ์ ํ๋๋ฐ ๋๋ฌด ์ฌ์ ๊ฐ ์์๋ค.
Leonardong:
์ฒซ ๋ชจ์์ด๋ผ ์คํฐ๋ ๋ฐฉ์์ ์ ํ๋๋ฐ ์๊ฐ์ด ์ค๋ ๊ฑธ๋ ธ๋ค. ํ์์ด์ PairProgramming ์ ํ๋๋ฐ ๋๋ฌด ์ฌ์ ๊ฐ ์์๋ค.
Leonardong:
์๊ณ ๋ฆฌ์ฆ์ ์์๋ ์ฝ๋๋ก ๋ฐ๋ก ํ์ด์ฐ๊ธฐ๊ฐ ์ ๋๋ค. ๊ทธ๋ด ๋๋ ๊ฐ์ง ์ฝ๋(psuedo code)๋ฅผ ์ ์ด๋ณด๋ ๊ฒ์ด ๋์์ด ๋๋ค.










