摘要: 国际象棋八皇后相容排阵问题:My code of today#include //八皇后求解int k=0,result[10]={0};int main(){void search();void shresult();search();return(0);}//Show the resultvoid shresult(){for(k=0;k<8;k++) cout<<result[k]<<',';cout<<"/t OK"<<endl;}//Searchingthe answer for the pro 阅读全文
posted @ 2008-04-27 21:24 鱼木 阅读(119) 评论(0) 推荐(0)
摘要: //输入一组数据,有序存入一维数组存储区内#include void sort2(){ int m[10]; for(int i=0;i>m[i]; int j = i; while( (m[j] < m[j-1]) && (j != 0) ) { int t = m[j-1]; m[j-1] =m[j]; m[j] = t; j--; } } for(i=0;i<10;i++) { cout<<m[i]<<' '; } cout<<endl;} 阅读全文
posted @ 2008-04-27 19:54 鱼木 阅读(104) 评论(0) 推荐(0)