Visual Studio 2008 Express Edition ¤Ç¥È¥é¥ó¥×¥²¡¼¥à¤òºî¤í¤¦
8ÆüÌÜ¡¡£Ö£Â£Á¤Î¥ê¥¹¥È¤ò£Ã¡Ü¡Ü¤ËÊÑ´¹¤·¤Æ¤ß¤è¤¦
2ÆüÌܤγؽ¬
¤«¤éºÆ¥¹¥¿¡¼¥È
Éü½¬
¤³¤Î¡¥ë¡¼¥Á¥ó¤È¥Ü¥¿¥ó£±¡¡¢¤ÎÆâÍƤ¬É¬ÍפǤ¹¡£
//¡
static int card[55];
static int hai[12];
static int keta[12];
static int yaku[12];
static int start_flag=0;
static int hoji1=0;
static int hoji2=0;
static int hoji3=0;
static int hoji4=0;
static int hoji5=0;
static int tokuten=0;
void DispHai( int nohai,int xx){
Graphics^ gr=this->CreateGraphics();
int X0=10,Y0=1;
String^ filename;
filename="c:\\card\\1_sp.gif";
if(nohai==0 ) filename="c:\\card\\0_r1.gif" ;
//Pen^ pen1=gcnew Pen(col);
if(nohai>0 && nohai<14) filename="c:\\card\\"+nohai+"_sp.gif" ;
if(nohai>100 && nohai<114 ){nohai=nohai-100;
filename="c:\\card\\"+nohai+"_cl.gif" ;}
if(nohai>200 && nohai<214 ){nohai=nohai-200;
filename="c:\\card\\"+nohai+"_di.gif" ;}
if(nohai>300 && nohai<314){nohai=nohai-300;
filename="c:\\card\\"+nohai+"_he.gif" ;}
//¸¶²èÁü¤òº¸¾å¤ËÉÁ²è¤¹¤ë
if(xx==1){
Bitmap^ bmap1; //bmap1¤Î³ÎÊÝ
bmap1=gcnew Bitmap(filename);
gr->DrawImage(bmap1,X0,Y0);
}
if(xx==2){
Bitmap^ bmap2; //bmap2¤Î³ÎÊÝ
bmap2=gcnew Bitmap(filename);
gr->DrawImage(bmap2,X0+100,Y0);
}
if(xx==3){
Bitmap^ bmap3; //bmap3¤Î³ÎÊÝ
bmap3=gcnew Bitmap(filename);
gr->DrawImage(bmap3,X0+200,Y0);
}
if(xx==4){
Bitmap^ bmap4; //bmap4¤Î³ÎÊÝ
bmap4=gcnew Bitmap(filename);
gr->DrawImage(bmap4,X0+300,Y0);
}
if(xx==5){
Bitmap^ bmap5; //bmap5¤Î³ÎÊÝ
bmap5=gcnew Bitmap(filename);
gr->DrawImage(bmap5,X0+400,Y0);
}
}
//¢
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if(start_flag ==0){ //°ìÅÙÄ̲ᤷ¤¿¤éÅÙÌܤò¶Ø»ß¤¹¤ë
int amax,xrand,nohai;
int xx,yy,y;
char buf[80];
Graphics^ gr=this->CreateGraphics();
String^ string1;
Brush^ brush=gcnew SolidBrush(Color::Black);
System::Drawing::Font^ font=gcnew System::Drawing::Font("MS ¥´¥·¥Ã¥¯",10);
Random^ rand=gcnew Random(); //¤ÇÍð¿ôrand¤òÀ¸À®¤·¤Æ¤ª¤¡¢
//£²¡Ë¡¡°Ê¾åint amax̤Ëþ¤ÎÍð¿ô¤òȯÀ¸¤·¤¿¤¤¾ì¹ç¤Ë¤Ï¡¢
amax=52;
for(xx=1;xx<54;xx++) card[xx]=0;
yy=1;
while(yy<20){
xrand=rand->Next(amax)+1;
int flag=0;
for(xx=1;xx<53;xx++) {if(card[xx]==xrand) flag=1;}
if(flag==0){ card[yy]=xrand;
//ʸ»ú¤Ç³Îǧ
sprintf_s(buf,80," %3d ",xrand);
string1=gcnew String(buf);
gr->DrawString(string1,font,brush,(float)16*yy,(float)300);
//ʸ»ú¤Ç³Îǧ½ªÎ»
yy++;}
}
for(y=1;y<53;y++){
if( card[y] > 13 && card[y] <= 26) card[y] = card[y] + 100 - 13;
if( card[y] > 26 && card[y] <= 39) card[y] = card[y] + 200 - 26;
if( card[y] > 39 && card[y] <= 52) card[y] = card[y] + 300 - 39;
} //end for y
for(xx=1;xx<6;xx++){
hai[xx]=card[xx];
}
for(xx=1;xx<6;xx++){
nohai=hai[xx];
DispHai(nohai,xx);
}
//¼¡¤Î¤è¤¦¤ËÊѹ¹¡¡ÀĤòÀÖ¤Ë
for(xx=1;xx<6;xx++){
DispHai(0,xx);
}
hoji1=0;
hoji2=0;
hoji3=0;
hoji4=0;
hoji5=0;
start_flag=1; //°ìÅÙÄ̲ᤷ¤¿¤éÅÙÌܤò¶Ø»ß¤¹¤ë¥Õ¥é¥Ã¥°
}//end if start_flag=1;°ìÅÙÄ̲ᤷ¤¿¤éÅÙÌܤò¶Ø»ß¤¹¤ë
}
¥Ü¥¿¥ó£²¤ò¥¯¥ê¥Ã¥¯¤·¤Æ
¼¡¤Î¤è¤¦¤Ë¥«¡¼¥É¤Îɽ¼¨¤ò¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹
basic¤ÎÆâÍÆ¡ÚÎСۤò¼¡¤Î¤è¤¦¤ËÊѹ¹¤¹¤ë¡ÚÀÖ¡Û
ÎФÎÉôʬ¤«¤éƱ¤¸½ê¤òÀÚ¤ê¼è¤ë
basic | £ã¡Ü¡Ü |
End Sub Private Sub disp() End Sub Private Sub CommandButton2_Click() End Sub |
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
|
»²¹Í
void DispHai( int nohai,int xx){
Graphics^ gr=this->CreateGraphics();
int X0=10,Y0=1;
String^ filename;
filename="c:\\card\\1_sp.gif";
if(nohai==0 ) filename="c:\\card\\0_r1.gif" ;
//Pen^ pen1=gcnew Pen(col);
if(nohai>0 && nohai<14) filename="c:\\card\\"+nohai+"_sp.gif" ;
if(nohai>100 && nohai<114 ){nohai=nohai-100;
filename="c:\\card\\"+nohai+"_cl.gif" ;}
if(nohai>200 && nohai<214 ){nohai=nohai-200;
filename="c:\\card\\"+nohai+"_di.gif" ;}
if(nohai>300 && nohai<314){nohai=nohai-300;
filename="c:\\card\\"+nohai+"_he.gif" ;}
//¸¶²èÁü¤òº¸¾å¤ËÉÁ²è¤¹¤ë
if(xx==1){
Bitmap^ bmap1; //bmap1¤Î³ÎÊÝ
bmap1=gcnew Bitmap(filename);
gr->DrawImage(bmap1,X0,Y0);
}
if(xx==2){
Bitmap^ bmap2; //bmap2¤Î³ÎÊÝ
bmap2=gcnew Bitmap(filename);
gr->DrawImage(bmap2,X0+100,Y0);
}
if(xx==3){
Bitmap^ bmap3; //bmap3¤Î³ÎÊÝ
bmap3=gcnew Bitmap(filename);
gr->DrawImage(bmap3,X0+200,Y0);
}
if(xx==4){
Bitmap^ bmap4; //bmap4¤Î³ÎÊÝ
bmap4=gcnew Bitmap(filename);
gr->DrawImage(bmap4,X0+300,Y0);
}
if(xx==5){
Bitmap^ bmap5; //bmap5¤Î³ÎÊÝ
bmap5=gcnew Bitmap(filename);
gr->DrawImage(bmap5,X0+400,Y0);
}
}
private: System::Void Form1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
Graphics^ gr=e->Graphics;
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if(start_flag ==0){ //°ìÅÙÄ̲ᤷ¤¿¤éÅÙÌܤò¶Ø»ß¤¹¤ë
int amax,xrand,nohai;
int xx,yy,y;
char buf[80];
Graphics^ gr=this->CreateGraphics();
String^ string1;
Brush^ brush=gcnew SolidBrush(Color::Black);
System::Drawing::Font^ font=gcnew System::Drawing::Font("MS ¥´¥·¥Ã¥¯",10);
Random^ rand=gcnew Random(); //¤ÇÍð¿ôrand¤òÀ¸À®¤·¤Æ¤ª¤¡¢
//£²¡Ë¡¡°Ê¾åint amax̤Ëþ¤ÎÍð¿ô¤òȯÀ¸¤·¤¿¤¤¾ì¹ç¤Ë¤Ï¡¢
amax=52;
for(xx=1;xx<54;xx++) card[xx]=0;
yy=1;
while(yy<20){
xrand=rand->Next(amax)+1;
int flag=0;
for(xx=1;xx<53;xx++) {if(card[xx]==xrand) flag=1;}
if(flag==0){ card[yy]=xrand;
//ʸ»ú¤Ç³Îǧ
sprintf_s(buf,80," %3d ",xrand);
string1=gcnew String(buf);
gr->DrawString(string1,font,brush,(float)16*yy,(float)300);
//ʸ»ú¤Ç³Îǧ½ªÎ»
yy++;}
}
for(y=1;y<53;y++){
if( card[y] > 13 && card[y] <= 26) card[y] = card[y] + 100 - 13;
if( card[y] > 26 && card[y] <= 39) card[y] = card[y] + 200 - 26;
if( card[y] > 39 && card[y] <= 52) card[y] = card[y] + 300 - 39;
} //end for y
for(xx=1;xx<6;xx++){
DispHai(0,xx);
}
hoji1=0;
hoji2=0;
hoji3=0;
hoji4=0;
hoji5=0;
start_flag=1; //°ìÅÙÄ̲ᤷ¤¿¤éÅÙÌܤò¶Ø»ß¤¹¤ë¥Õ¥é¥Ã¥°
}//end if start_flag=1;°ìÅÙÄ̲ᤷ¤¿¤éÅÙÌܤò¶Ø»ß¤¹¤ë
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
int xx;
for(xx=1;xx<6;xx++){
DispHai(card[xx],xx);
}
¼ÂºÝ¤Îsample¡¡sample4.exe sample4.zip