2010年1月20日 星期三
2009年12月22日 星期二
2009年12月13日 星期日
[閱讀]行銷,就是讓消費者替你說好話
與顧客搏感情留住顧客、提升忠誠度,
以難忘的體驗,讓消費者吃好道相報,
口耳相傳力量大,讓顧客瘋你的產品,
不只買你的東西,還樂於替你的產品代言。
2009年12月12日 星期六
2009年12月9日 星期三
[C++] 井字遊戲程式碼
這個程式用到三維空間陣列概念 用提示命令字元視窗模擬
寫得不是很精簡拉XD
Class TicTacToe{
public:
TicTacToe();
void Make();
private:
void judge();
int winner,i,j,count,linesum,side,choice;
int **game;
char ***display; //三維陣列
};
TicTacToe::TicTacToe(){
cout<<"----井字遊戲----"<<endl;
count=0;
for(i=0;i<5;i++){
for(j=0;j<5;j++){
if(i==1||i==3) cout<<"-";
if(j==1||j==3){
if(i!=1&&i!=3) cout<<" |";
}
}
cout<<endl;
}
for(i=1;i<=9;i++){
cout<<i<<" ";
if(i%3==0) cout<<endl;
}
cout<<endl;
linesum=0;
side=1;
winner=0;
game=new int*[3]; //初始化二維陣列
for(i=0;i<3;i++) game[i]=new int[3];
for(i=0;i<3;i++){
for(j=0;j<3;j++) game[i][j]=0;}
display=new char**[3];
for(i=0;i<3;i++) display[i]=new char*[3];
for(i=0;i<3;i++){
for(j=0;j<3;j++) display[i][j]=new char[1];}
for(i=0;i<3;i++){
for(j=0;j<3;j++) strcpy(display[i][j],"-");}
}
void TicTacToe::Make(){
cout<<"開始PK!!!!!"<<endl<<endl;
while(winner==0){
if(side==1){
cout<<"Player1.....*"<<endl;
cin>>choice;
choice--;
while(game[choice/3][choice%3]!=0){
cout<<"已經劃過!!!";
cin>>choice;
choice--;
}
strcpy(display[choice/3][choice%3],"*");
game[choice/3][choice%3]=1;
side=2;
cout<<"Round : "<<count+1<<endl<<endl;
count++;
for(i=0;i<3;i++){
for(j=0;j<3;j++){
cout<<display[i][j];
}
cout<<endl;
}
cout<<endl;
judge();
}
else if(side==2){
cout<<"Player2.....O"<<endl;
cin>>choice;
choice--;
while(game[choice/3][choice%3]!=0){
cout<<"已經劃過!!!";
cin>>choice;
choice--;
}
strcpy(display[choice/3][choice%3],"O");
game[choice/3][choice%3]=4;
side=1;//丟選擇權
count++;
cout<<"Round : "<<count<<endl<<endl;
for(i=0;i<3;i++){
for(j=0;j<3;j++){
cout<<display[i][j];
}
cout<<endl;
}
cout<<endl;
}
judge();
if(count==9) winner=1;
}
cout<<"平手"<<endl;
system("pause");
}
void TicTacToe::judge(){
for(i=0;i<3;i++){
for(j=0;j<3;j++){
linesum=linesum+game[i][j];
}
if(linesum==3){cout<<"PLATER 1 WIN!!!"<<endl;
system("pause");}
if(linesum==12){cout<<"PLATER 2 WIN!!!"<<endl;
system("pause");}
linesum=0;
}
for(i=0;i<3;i++){
for(j=0;j<3;j++){
linesum=linesum+game[j][i];
}
if(linesum==3){cout<<"PLATER 1 WIN!!!"<<endl;
system("pause");}
if(linesum==12){cout<<"PLATER 2 WIN!!!"<<endl;
system("pause");}
linesum=0;
}
if(game[0][0]+game[1][1]+game[2][2]==3){
cout<<"PLATER 1 WIN!!!"<<endl;
system("pause");}
if(game[0][0]+game[1][1]+game[2][2]==12){
cout<<"PLATER 2 WIN!!!"<<endl;
system("pause");}
if(game[2][0]+game[1][1]+game[0][2]==3){
cout<<"PLATER 1 WIN!!!"<<endl;
system("pause");}
if(game[2][0]+game[1][1]+game[0][2]==12){
cout<<"PLATER 2 WIN!!!"<<endl;
system("pause");}
}
main(){
TicTacToe t;
t.Make();
system("pause");
}
2009年12月6日 星期日
IEEE 802.11 & IEEE 802.11e