//---------------------------------------------------------------------------
#pragma hdrstop
#include <conio.h>
#include <iostream.h>
//---------------------------------------------------------------------------
int main()
{
clrscr();
int i,j;
for(i=1;i<=22;i++){
for(j=1;j<=60;j++){
if(i==1) if(((j>=14)&&(j<=23))||((j>=39)&&(j<=48))) cout<<"*"; else cout<<" ";
else if(i==2) if(((j>=11)&&(j<=26))||((j>=36)&&(j<=51))) cout<<"*"; else cout<<" ";
else if(i==3) if(((j>=9)&&(j<=28))||((j>=34)&&(j<=53))) cout<<"*"; else cout<<" ";
else if(i==4) if(((j>=7)&&(j<=30))||((j>=32)&&(j<=55))) cout<<"*"; else cout<<" ";
else if((i>=5)&&(i<=8)) if((j>=5)&&(j<=57)) cout<<"*"; else cout<<" ";
else if(i==9) if((j>=7)&&(j<=55)) cout<<"*"; else cout<<" ";
else if(i==10) if((j>=9)&&(j<=53)) cout<<"*"; else cout<<" ";
else if(i==11) if((j>=11)&&(j<=51)) cout<<"*"; else cout<<" ";
else if(i==12) if((j>=13)&&(j<=49)) cout<<"*"; else cout<<" ";
else if(i==13) if((j>=15)&&(j<=47)) cout<<"*"; else cout<<" ";
else if(i==14) if((j>=17)&&(j<=45)) cout<<"*"; else cout<<" ";
else if(i==15) if((j>=19)&&(j<=43)) cout<<"*"; else cout<<" ";
else if(i==16) if((j>=21)&&(j<=41)) cout<<"*"; else cout<<" ";
else if(i==17) if((j>=23)&&(j<=39)) cout<<"*"; else cout<<" ";
else if(i==18) if((j>=25)&&(j<=37)) cout<<"*"; else cout<<" ";
else if(i==19) if((j>=27)&&(j<=35)) cout<<"*"; else cout<<" ";
else if(i==20) if((j>=29)&&(j<=33)) cout<<"*"; else cout<<" ";
else if(i==21) if((j>=30)&&(j<=32)) cout<<"*"; else cout<<" ";
else if(i==22) if(j==31) cout<<"*"; else cout<<" ";
}
cout<<"\n";
}
getch();
}
//---------------------------------------------------------------------------
Senin, 21 Oktober 2013
Jumat, 18 Oktober 2013
GAME SEDERHANA C++
#pragma hrdstop
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
main()
{
char abc, a, b, c, d, e, f, g, h, i;
atas:
clrscr();
gotoxy(70,1);
cout<<">>>HS-32<<<";
gotoxy(10,2);
cout<<"x x ooo";
gotoxy(10,3);
cout<<" x x o o";
gotoxy(10,4);
cout<<" x o o";
gotoxy(10,5);
cout<<" x x o o";
gotoxy(10,6);
cout<<"x x ooo";
gotoxy(58,2);
cout<<"o o xxx";
gotoxy(58,3);
cout<<" o o x x";
gotoxy(58,4);
cout<<" o x x";
gotoxy(58,5);
cout<<" o o x x";
gotoxy(58,6);
cout<<"o o xxx";
gotoxy(33,1);
cout<<"-------------";
gotoxy(33,2);
cout<<"| 1 | 2 | 3 |";
gotoxy(33,3);
cout<<"----+---+----";
gotoxy(33,4);
cout<<"| 4 | 5 | 6 |";
gotoxy(33,5);
cout<<"----+---+----";
gotoxy(33,6);
cout<<"| 7 | 8 | 9 |";
gotoxy(33,7);
cout<<"-------------";
gotoxy(1,9);
cout<<"\t\t Tekan [enter] untuk memulai permainan!";
abc=getche();
if (abc=='1')
{exit(0);}
else
{
cout<<endl<<endl;
cout<<"\t\t\t\t-------------\n";
cout<<"\t\t\t\t| | | |\n";
cout<<"\t\t\t\t----+---+----\n";
cout<<"\t\t\t\t| | | |\n";
cout<<"\t\t\t\t----+---+----\n";
cout<<"\t\t\t\t| | | |\n";
cout<<"\t\t\t\t-------------\n\n";
cout<<" Pilih angka antara 1 sampai 9 : \n";
cout<<" Player 1 : ";
cin>>a;
if (a=='1')
{gotoxy(35,12);
cout<<"X";}
else if (a=='2')
{gotoxy(39,12);
cout<<"X";}
else if (a=='3')
{gotoxy(43,12);
cout<<"X";}
else if (a=='4')
{gotoxy(35,14);
cout<<"X";}
else if (a=='5')
{gotoxy(39,14);
cout<<"X";}
else if (a=='6')
{gotoxy(43,14);
cout<<"X";}
else if (a=='7')
{gotoxy(35,16);
cout<<"X";}
else if (a=='8')
{gotoxy(39,16);
cout<<"X";}
else
{gotoxy(43,16);
cout<<"X";}
gotoxy(1,21);
cout<<" Player 2 : ";
cin>>b;
if (b=='1')
{gotoxy(35,12);
cout<<"O";}
else if (b=='2')
{gotoxy(39,12);
cout<<"O";}
else if (b=='3')
{gotoxy(43,12);
cout<<"O";}
else if (b=='4')
{gotoxy(35,14);
cout<<"O";}
else if (b=='5')
{gotoxy(39,14);
cout<<"O";}
else if (b=='6')
{gotoxy(43,14);
cout<<"O";}
else if (b=='7')
{gotoxy(35,16);
cout<<"O";}
else if (b=='8')
{gotoxy(39,16);
cout<<"O";}
else
{gotoxy(43,16);
cout<<"O";}
gotoxy(16,20);
cout<<" Player 1 : ";
cin>>c;
if (c=='1')
{gotoxy(35,12);
cout<<"X";}
else if (c=='2')
{gotoxy(39,12);
cout<<"X";}
else if (c=='3')
{gotoxy(43,12);
cout<<"X";}
else if (c=='4')
{gotoxy(35,14);
cout<<"X";}
else if (c=='5')
{gotoxy(39,14);
cout<<"X";}
else if (c=='6')
{gotoxy(43,14);
cout<<"X";}
else if (c=='7')
{gotoxy(35,16);
cout<<"X";}
else if (c=='8')
{gotoxy(39,16);
cout<<"X";}
else
{gotoxy(43,16);
cout<<"X";}
gotoxy(16,21);
cout<<" Player 2 : ";
cin>>d;
if (d=='1')
{gotoxy(35,12);
cout<<"O";}
else if (d=='2')
{gotoxy(39,12);
cout<<"O";}
else if (d=='3')
{gotoxy(43,12);
cout<<"O";}
else if (d=='4')
{gotoxy(35,14);
cout<<"O";}
else if (d=='5')
{gotoxy(39,14);
cout<<"O";}
else if (d=='6')
{gotoxy(43,14);
cout<<"O";}
else if (d=='7')
{gotoxy(35,16);
cout<<"O";}
else if (d=='8')
{gotoxy(39,16);
cout<<"O";}
else
{gotoxy(43,16);
cout<<"O";}
gotoxy(31,20);
cout<<" Player 1 : ";
cin>>e;
if (e=='1')
{gotoxy(35,12);
cout<<"X";}
else if (e=='2')
{gotoxy(39,12);
cout<<"X";}
else if (e=='3')
{gotoxy(43,12);
cout<<"X";}
else if (e=='4')
{gotoxy(35,14);
cout<<"X";}
else if (e=='5')
{gotoxy(39,14);
cout<<"X";}
else if (e=='6')
{gotoxy(43,14);
cout<<"X";}
else if (e=='7')
{gotoxy(35,16);
cout<<"X";}
else if (e=='8')
{gotoxy(39,16);
cout<<"X";}
else
{gotoxy(43,16);
cout<<"X";}
if (((a=='1' || a=='2' || a=='3') && (c=='1' || c=='2' || c=='3') && (e=='1' || e=='2' || e=='3')) ||
((a=='4' || a=='5' || a=='6') && (c=='4' || c=='5' || c=='6') && (e=='4' || e=='5' || e=='6')) ||
((a=='7' || a=='8' || a=='9') && (c=='7' || c=='8' || c=='9') && (e=='7' || e=='8' || e=='9')) ||
((a=='1' || a=='4' || a=='7') && (c=='1' || c=='4' || c=='7') && (e=='1' || e=='4' || e=='7')) ||
((a=='2' || a=='5' || a=='8') && (c=='2' || c=='5' || c=='8') && (e=='2' || e=='5' || e=='8')) ||
((a=='3' || a=='6' || a=='9') && (c=='3' || c=='6' || c=='9') && (e=='3' || e=='6' || e=='9')) ||
((a=='1' || a=='5' || a=='9') && (c=='1' || c=='5' || c=='9') && (e=='1' || e=='5' || e=='9')) ||
((a=='3' || a=='5' || a=='7') && (c=='3' || c=='5' || c=='7') && (e=='3' || e=='5' || e=='7')))
{gotoxy(1,23);
cout<<"\t\t\tPlayer 1 Menang!!!\n";
cout<<"Tekan [1] untuk main lagi, dan tekan [2] untuk keluar dari permainan!";
cin>>abc;
if (abc=='1')
{goto atas;}
else
{exit(0);}}
else
{
gotoxy(31,21);
cout<<" Player 2 : ";
cin>>f;
if (f=='1')
{gotoxy(35,12);
cout<<"O";}
else if (f=='2')
{gotoxy(39,12);
cout<<"O";}
else if (f=='3')
{gotoxy(43,12);
cout<<"O";}
else if (f=='4')
{gotoxy(35,14);
cout<<"O";}
else if (f=='5')
{gotoxy(39,14);
cout<<"O";}
else if (f=='6')
{gotoxy(43,14);
cout<<"O";}
else if (f=='7')
{gotoxy(35,16);
cout<<"O";}
else if (f=='8')
{gotoxy(39,16);
cout<<"O";}
else
{gotoxy(43,16);
cout<<"O";}
if (((b=='1' || b=='2' || b=='3') && (d=='1' || d=='2' || d=='3') && (f=='1' || f=='2' || f=='3')) ||
((b=='4' || b=='5' || b=='6') && (d=='4' || d=='5' || d=='6') && (f=='4' || f=='5' || f=='6')) ||
((b=='7' || b=='8' || b=='9') && (d=='7' || d=='8' || d=='9') && (f=='7' || f=='8' || f=='9')) ||
((b=='1' || b=='4' || b=='7') && (d=='1' || d=='4' || d=='7') && (f=='1' || f=='4' || f=='7')) ||
((b=='2' || b=='5' || b=='8') && (d=='2' || d=='5' || d=='8') && (f=='2' || f=='5' || f=='8')) ||
((b=='3' || b=='6' || b=='9') && (d=='3' || d=='6' || d=='9') && (f=='3' || f=='6' || f=='9')) ||
((b=='1' || b=='5' || b=='9') && (d=='1' || d=='5' || d=='9') && (f=='1' || f=='5' || f=='9')) ||
((b=='3' || b=='5' || b=='7') && (d=='3' || d=='5' || d=='7') && (f=='3' || f=='5' || f=='7')))
{gotoxy(1,23);
cout<<"\t\t\tPlayer 2 Menang!!!\n";
cout<<"Tekan [1] untuk main lagi, dan tekan [2] untuk keluar dari permainan!";
cin>>abc;
if (abc=='1')
{goto atas;}
else
{exit(0);}}
else
{
gotoxy(46,20);
cout<<" Player 1 : ";
cin>>g;
if (g=='1')
{gotoxy(35,12);
cout<<"X";}
else if (g=='2')
{gotoxy(39,12);
cout<<"X";}
else if (g=='3')
{gotoxy(43,12);
cout<<"X";}
else if (g=='4')
{gotoxy(35,14);
cout<<"X";}
else if (g=='5')
{gotoxy(39,14);
cout<<"X";}
else if (g=='6')
{gotoxy(43,14);
cout<<"X";}
else if (g=='7')
{gotoxy(35,16);
cout<<"X";}
else if (g=='8')
{gotoxy(39,16);
cout<<"X";}
else
{gotoxy(43,16);
cout<<"X";}
if (((a=='1' || a=='2' || a=='3') && (c=='1' || c=='2' || c=='3') && (g=='1' || g=='2' || g=='3')) ||
((a=='4' || a=='5' || a=='6') && (c=='4' || c=='5' || c=='6') && (g=='4' || g=='5' || g=='6')) ||
((a=='7' || a=='8' || a=='9') && (c=='7' || c=='8' || c=='9') && (g=='7' || g=='8' || g=='9')) ||
((a=='1' || a=='4' || a=='7') && (c=='1' || c=='4' || c=='7') && (g=='1' || g=='4' || g=='7')) ||
((a=='2' || a=='5' || a=='8') && (c=='2' || c=='5' || c=='8') && (g=='2' || g=='5' || g=='8')) ||
((a=='3' || a=='6' || a=='9') && (c=='3' || c=='6' || c=='9') && (g=='3' || g=='6' || g=='9')) ||
((a=='1' || a=='5' || a=='9') && (c=='1' || c=='5' || c=='9') && (g=='1' || g=='5' || g=='9')) ||
((a=='3' || a=='5' || a=='7') && (c=='3' || c=='5' || c=='7') && (g=='3' || g=='5' || g=='7')) ||
((a=='1' || a=='2' || a=='3') && (g=='1' || g=='2' || g=='3') && (e=='1' || e=='2' || e=='3')) ||
((a=='4' || a=='5' || a=='6') && (g=='4' || g=='5' || g=='6') && (e=='4' || e=='5' || e=='6')) ||
((a=='7' || a=='8' || a=='9') && (g=='7' || g=='8' || g=='9') && (e=='7' || e=='8' || e=='9')) ||
((a=='1' || a=='4' || a=='7') && (g=='1' || g=='4' || g=='7') && (e=='1' || e=='4' || e=='7')) ||
((a=='2' || a=='5' || a=='8') && (g=='2' || g=='5' || g=='8') && (e=='2' || e=='5' || e=='8')) ||
((a=='3' || a=='6' || a=='9') && (g=='3' || g=='6' || g=='9') && (e=='3' || e=='6' || e=='9')) ||
((a=='1' || a=='5' || a=='9') && (g=='1' || g=='5' || g=='9') && (e=='1' || e=='5' || e=='9')) ||
((a=='3' || a=='5' || a=='7') && (g=='3' || g=='5' || g=='7') && (e=='3' || e=='5' || e=='7')) ||
((g=='1' || g=='2' || g=='3') && (c=='1' || c=='2' || c=='3') && (e=='1' || e=='2' || e=='3')) ||
((g=='4' || g=='5' || g=='6') && (c=='4' || c=='5' || c=='6') && (e=='4' || e=='5' || e=='6')) ||
((g=='7' || g=='8' || g=='9') && (c=='7' || c=='8' || c=='9') && (e=='7' || e=='8' || e=='9')) ||
((g=='1' || g=='4' || g=='7') && (c=='1' || c=='4' || c=='7') && (e=='1' || e=='4' || e=='7')) ||
((g=='2' || g=='5' || g=='8') && (c=='2' || c=='5' || c=='8') && (e=='2' || e=='5' || e=='8')) ||
((g=='3' || g=='6' || g=='9') && (c=='3' || c=='6' || c=='9') && (e=='3' || e=='6' || e=='9')) ||
((g=='1' || g=='5' || g=='9') && (c=='1' || c=='5' || c=='9') && (e=='1' || e=='5' || e=='9')) ||
((g=='3' || g=='5' || g=='7') && (c=='3' || c=='5' || c=='7') && (e=='3' || e=='5' || e=='7')))
{gotoxy(1,23);
cout<<"\t\t\tPlayer 1 Menang!!!\n";
cout<<"Tekan [1] untuk main lagi, dan tekan [2] untuk keluar dari permainan!";
cin>>abc;
if (abc=='1')
{goto atas;}
else
{exit(0);}}
else
{
gotoxy(46,21);
cout<<" Player 2 : ";
cin>>h;
if (h=='1')
{gotoxy(35,12);
cout<<"O";}
else if (h=='2')
{gotoxy(39,12);
cout<<"O";}
else if (h=='3')
{gotoxy(43,12);
cout<<"O";}
else if (h=='4')
{gotoxy(35,14);
cout<<"O";}
else if (h=='5')
{gotoxy(39,14);
cout<<"O";}
else if (h=='6')
{gotoxy(43,14);
cout<<"O";}
else if (h=='7')
{gotoxy(35,16);
cout<<"O";}
else if (h=='8')
{gotoxy(39,16);
cout<<"O";}
else
{gotoxy(43,16);
cout<<"O";}
if (((b=='1' || b=='2' || b=='3') && (d=='1' || d=='2' || d=='3') && (h=='1' || h=='2' || h=='3')) ||
((b=='4' || b=='5' || b=='6') && (d=='4' || d=='5' || d=='6') && (h=='4' || h=='5' || h=='6')) ||
((b=='7' || b=='8' || b=='9') && (d=='7' || d=='8' || d=='9') && (h=='7' || h=='8' || h=='9')) ||
((b=='1' || b=='4' || b=='7') && (d=='1' || d=='4' || d=='7') && (h=='1' || h=='4' || h=='7')) ||
((b=='2' || b=='5' || b=='8') && (d=='2' || d=='5' || d=='8') && (h=='2' || h=='5' || h=='8')) ||
((b=='3' || b=='6' || b=='9') && (d=='3' || d=='6' || d=='9') && (h=='3' || h=='6' || h=='9')) ||
((b=='1' || b=='5' || b=='9') && (d=='1' || d=='5' || d=='9') && (h=='1' || h=='5' || h=='9')) ||
((b=='3' || b=='5' || b=='7') && (d=='3' || d=='5' || d=='7') && (h=='3' || h=='5' || h=='7')) ||
((b=='1' || b=='2' || b=='3') && (h=='1' || h=='2' || h=='3') && (f=='1' || f=='2' || f=='3')) ||
((b=='4' || b=='5' || b=='6') && (h=='4' || h=='5' || h=='6') && (f=='4' || f=='5' || f=='6')) ||
((b=='7' || b=='8' || b=='9') && (h=='7' || h=='8' || h=='9') && (f=='7' || f=='8' || f=='9')) ||
((b=='1' || b=='4' || b=='7') && (h=='1' || h=='4' || h=='7') && (f=='1' || f=='4' || f=='7')) ||
((b=='2' || b=='5' || b=='8') && (h=='2' || h=='5' || h=='8') && (f=='2' || f=='5' || f=='8')) ||
((b=='3' || b=='6' || b=='9') && (h=='3' || h=='6' || h=='9') && (f=='3' || f=='6' || f=='9')) ||
((b=='1' || b=='5' || b=='9') && (h=='1' || h=='5' || h=='9') && (f=='1' || f=='5' || f=='9')) ||
((b=='3' || b=='5' || b=='7') && (h=='3' || h=='5' || h=='7') && (f=='3' || f=='5' || f=='7')) ||
((h=='1' || h=='2' || h=='3') && (d=='1' || d=='2' || d=='3') && (f=='1' || f=='2' || f=='3')) ||
((h=='4' || h=='5' || h=='6') && (d=='4' || d=='5' || d=='6') && (f=='4' || f=='5' || f=='6')) ||
((h=='7' || h=='8' || h=='9') && (d=='7' || d=='8' || d=='9') && (f=='7' || f=='8' || f=='9')) ||
((h=='1' || h=='4' || h=='7') && (d=='1' || d=='4' || d=='7') && (f=='1' || f=='4' || f=='7')) ||
((h=='2' || h=='5' || h=='8') && (d=='2' || d=='5' || d=='8') && (f=='2' || f=='5' || f=='8')) ||
((h=='3' || h=='6' || h=='9') && (d=='3' || d=='6' || d=='9') && (f=='3' || f=='6' || f=='9')) ||
((h=='1' || h=='5' || h=='9') && (d=='1' || d=='5' || d=='9') && (f=='1' || f=='5' || f=='9')) ||
((h=='3' || h=='5' || h=='7') && (d=='3' || d=='5' || d=='7') && (f=='3' || f=='5' || f=='7')))
{gotoxy(1,23);
cout<<"\t\t\tPlayer 2 Menang!!!\n";
cout<<"Tekan [1] untuk main lagi, dan tekan [2] untuk keluar dari permainan!";
cin>>abc;
if (abc=='1')
{goto atas;}
else
{exit(0);}}
else
{
gotoxy(61,20);
cout<<" Player 1 : ";
cin>>i;
if (i=='1')
{gotoxy(35,12);
cout<<"X";}
else if (i=='2')
{gotoxy(39,12);
cout<<"X";}
else if (i=='3')
{gotoxy(43,12);
cout<<"X";}
else if (i=='4')
{gotoxy(35,14);
cout<<"X";}
else if (i=='5')
{gotoxy(39,14);
cout<<"X";}
else if (i=='6')
{gotoxy(43,14);
cout<<"X";}
else if (i=='7')
{gotoxy(35,16);
cout<<"X";}
else if (i=='8')
{gotoxy(39,16);
cout<<"X";}
else
{gotoxy(43,16);
cout<<"X";}
if (((a=='1' || a=='2' || a=='3') && (c=='1' || c=='2' || c=='3') && (i=='1' || i=='2' || i=='3')) ||
((a=='4' || a=='5' || a=='6') && (c=='4' || c=='5' || c=='6') && (i=='4' || i=='5' || i=='6')) ||
((a=='7' || a=='8' || a=='9') && (c=='7' || c=='8' || c=='9') && (i=='7' || i=='8' || i=='9')) ||
((a=='1' || a=='4' || a=='7') && (c=='1' || c=='4' || c=='7') && (i=='1' || i=='4' || i=='7')) ||
((a=='2' || a=='5' || a=='8') && (c=='2' || c=='5' || c=='8') && (i=='2' || i=='5' || i=='8')) ||
((a=='3' || a=='6' || a=='9') && (c=='3' || c=='6' || c=='9') && (i=='3' || i=='6' || i=='9')) ||
((a=='1' || a=='5' || a=='9') && (c=='1' || c=='5' || c=='9') && (i=='1' || i=='5' || i=='9')) ||
((a=='3' || a=='5' || a=='7') && (c=='3' || c=='5' || c=='7') && (i=='3' || i=='5' || i=='7')) ||
((a=='1' || a=='2' || a=='3') && (i=='1' || i=='2' || i=='3') && (e=='1' || e=='2' || e=='3')) ||
((a=='4' || a=='5' || a=='6') && (i=='4' || i=='5' || i=='6') && (e=='4' || e=='5' || e=='6')) ||
((a=='7' || a=='8' || a=='9') && (i=='7' || i=='8' || i=='9') && (e=='7' || e=='8' || e=='9')) ||
((a=='1' || a=='4' || a=='7') && (i=='1' || i=='4' || i=='7') && (e=='1' || e=='4' || e=='7')) ||
((a=='2' || a=='5' || a=='8') && (i=='2' || i=='5' || i=='8') && (e=='2' || e=='5' || e=='8')) ||
((a=='3' || a=='6' || a=='9') && (i=='3' || i=='6' || i=='9') && (e=='3' || e=='6' || e=='9')) ||
((a=='1' || a=='5' || a=='9') && (i=='1' || i=='5' || i=='9') && (e=='1' || e=='5' || e=='9')) ||
((a=='3' || a=='5' || a=='7') && (i=='3' || i=='5' || i=='7') && (e=='3' || e=='5' || e=='7')) ||
((i=='1' || i=='2' || i=='3') && (c=='1' || c=='2' || c=='3') && (e=='1' || e=='2' || e=='3')) ||
((i=='4' || i=='5' || i=='6') && (c=='4' || c=='5' || c=='6') && (e=='4' || e=='5' || e=='6')) ||
((i=='7' || i=='8' || i=='9') && (c=='7' || c=='8' || c=='9') && (e=='7' || e=='8' || e=='9')) ||
((i=='1' || i=='4' || i=='7') && (c=='1' || c=='4' || c=='7') && (e=='1' || e=='4' || e=='7')) ||
((i=='2' || i=='5' || i=='8') && (c=='2' || c=='5' || c=='8') && (e=='2' || e=='5' || e=='8')) ||
((i=='3' || i=='6' || i=='9') && (c=='3' || c=='6' || c=='9') && (e=='3' || e=='6' || e=='9')) ||
((i=='1' || i=='5' || i=='9') && (c=='1' || c=='5' || c=='9') && (e=='1' || e=='5' || e=='9')) ||
((i=='3' || i=='5' || i=='7') && (c=='3' || c=='5' || c=='7') && (e=='3' || e=='5' || e=='7')) ||
((g=='1' || g=='2' || g=='3') && (c=='1' || c=='2' || c=='3') && (i=='1' || i=='2' || i=='3')) ||
((g=='4' || g=='5' || g=='6') && (c=='4' || c=='5' || c=='6') && (i=='4' || i=='5' || i=='6')) ||
((g=='7' || g=='8' || g=='9') && (c=='7' || c=='8' || c=='9') && (i=='7' || i=='8' || i=='9')) ||
((g=='1' || g=='4' || g=='7') && (c=='1' || c=='4' || c=='7') && (i=='1' || i=='4' || i=='7')) ||
((g=='2' || g=='5' || g=='8') && (c=='2' || c=='5' || c=='8') && (i=='2' || i=='5' || i=='8')) ||
((g=='3' || g=='6' || g=='9') && (c=='3' || c=='6' || c=='9') && (i=='3' || i=='6' || i=='9')) ||
((g=='1' || g=='5' || g=='9') && (c=='1' || c=='5' || c=='9') && (i=='1' || i=='5' || i=='9')) ||
((g=='3' || g=='5' || g=='7') && (c=='3' || c=='5' || c=='7') && (i=='3' || i=='5' || i=='7')) ||
((g=='1' || g=='2' || g=='3') && (i=='1' || i=='2' || i=='3') && (e=='1' || e=='2' || e=='3')) ||
((g=='4' || g=='5' || g=='6') && (i=='4' || i=='5' || i=='6') && (e=='4' || e=='5' || e=='6')) ||
((g=='7' || g=='8' || g=='9') && (i=='7' || i=='8' || i=='9') && (e=='7' || e=='8' || e=='9')) ||
((g=='1' || g=='4' || g=='7') && (i=='1' || i=='4' || i=='7') && (e=='1' || e=='4' || e=='7')) ||
((g=='2' || g=='5' || g=='8') && (i=='2' || i=='5' || i=='8') && (e=='2' || e=='5' || e=='8')) ||
((g=='3' || g=='6' || g=='9') && (i=='3' || i=='6' || i=='9') && (e=='3' || e=='6' || e=='9')) ||
((g=='1' || g=='5' || g=='9') && (i=='1' || i=='5' || i=='9') && (e=='1' || e=='5' || e=='9')) ||
((g=='3' || g=='5' || g=='7') && (i=='3' || i=='5' || i=='7') && (e=='3' || e=='5' || e=='7')) ||
((a=='1' || a=='2' || a=='3') && (g=='1' || g=='2' || g=='3') && (i=='1' || i=='2' || i=='3')) ||
((a=='4' || a=='5' || a=='6') && (g=='4' || g=='5' || g=='6') && (i=='4' || i=='5' || i=='6')) ||
((a=='7' || a=='8' || a=='9') && (g=='7' || g=='8' || g=='9') && (i=='7' || i=='8' || i=='9')) ||
((a=='1' || a=='4' || a=='7') && (g=='1' || g=='4' || g=='7') && (i=='1' || i=='4' || i=='7')) ||
((a=='2' || a=='5' || a=='8') && (g=='2' || g=='5' || g=='8') && (i=='2' || i=='5' || i=='8')) ||
((a=='3' || a=='6' || a=='9') && (g=='3' || g=='6' || g=='9') && (i=='3' || i=='6' || i=='9')) ||
((a=='1' || a=='5' || a=='9') && (g=='1' || g=='5' || g=='9') && (i=='1' || i=='5' || i=='9')) ||
((a=='3' || a=='5' || a=='7') && (g=='3' || g=='5' || g=='7') && (i=='3' || i=='5' || i=='7')))
{gotoxy(1,23);
cout<<"\t\t\tPlayer 1 Menang!!!\n";
cout<<"Tekan [1] untuk main lagi, dan tekan [2] untuk keluar dari permainan!";
cin>>abc;
if (abc=='1')
{goto atas;}
else
{exit(0);}}
else
{
gotoxy(1,23);
cout<<"\t\t\tPermainan Imbang!!!\n";
cout<<"Tekan [1] untuk main lagi, dan tekan [2] untuk keluar dari permainan!";
cin>>abc;
if (abc=='1')
{goto atas;}
else
{exit(0);}}}}}}}
getch();
}
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
main()
{
char abc, a, b, c, d, e, f, g, h, i;
atas:
clrscr();
gotoxy(70,1);
cout<<">>>HS-32<<<";
gotoxy(10,2);
cout<<"x x ooo";
gotoxy(10,3);
cout<<" x x o o";
gotoxy(10,4);
cout<<" x o o";
gotoxy(10,5);
cout<<" x x o o";
gotoxy(10,6);
cout<<"x x ooo";
gotoxy(58,2);
cout<<"o o xxx";
gotoxy(58,3);
cout<<" o o x x";
gotoxy(58,4);
cout<<" o x x";
gotoxy(58,5);
cout<<" o o x x";
gotoxy(58,6);
cout<<"o o xxx";
gotoxy(33,1);
cout<<"-------------";
gotoxy(33,2);
cout<<"| 1 | 2 | 3 |";
gotoxy(33,3);
cout<<"----+---+----";
gotoxy(33,4);
cout<<"| 4 | 5 | 6 |";
gotoxy(33,5);
cout<<"----+---+----";
gotoxy(33,6);
cout<<"| 7 | 8 | 9 |";
gotoxy(33,7);
cout<<"-------------";
gotoxy(1,9);
cout<<"\t\t Tekan [enter] untuk memulai permainan!";
abc=getche();
if (abc=='1')
{exit(0);}
else
{
cout<<endl<<endl;
cout<<"\t\t\t\t-------------\n";
cout<<"\t\t\t\t| | | |\n";
cout<<"\t\t\t\t----+---+----\n";
cout<<"\t\t\t\t| | | |\n";
cout<<"\t\t\t\t----+---+----\n";
cout<<"\t\t\t\t| | | |\n";
cout<<"\t\t\t\t-------------\n\n";
cout<<" Pilih angka antara 1 sampai 9 : \n";
cout<<" Player 1 : ";
cin>>a;
if (a=='1')
{gotoxy(35,12);
cout<<"X";}
else if (a=='2')
{gotoxy(39,12);
cout<<"X";}
else if (a=='3')
{gotoxy(43,12);
cout<<"X";}
else if (a=='4')
{gotoxy(35,14);
cout<<"X";}
else if (a=='5')
{gotoxy(39,14);
cout<<"X";}
else if (a=='6')
{gotoxy(43,14);
cout<<"X";}
else if (a=='7')
{gotoxy(35,16);
cout<<"X";}
else if (a=='8')
{gotoxy(39,16);
cout<<"X";}
else
{gotoxy(43,16);
cout<<"X";}
gotoxy(1,21);
cout<<" Player 2 : ";
cin>>b;
if (b=='1')
{gotoxy(35,12);
cout<<"O";}
else if (b=='2')
{gotoxy(39,12);
cout<<"O";}
else if (b=='3')
{gotoxy(43,12);
cout<<"O";}
else if (b=='4')
{gotoxy(35,14);
cout<<"O";}
else if (b=='5')
{gotoxy(39,14);
cout<<"O";}
else if (b=='6')
{gotoxy(43,14);
cout<<"O";}
else if (b=='7')
{gotoxy(35,16);
cout<<"O";}
else if (b=='8')
{gotoxy(39,16);
cout<<"O";}
else
{gotoxy(43,16);
cout<<"O";}
gotoxy(16,20);
cout<<" Player 1 : ";
cin>>c;
if (c=='1')
{gotoxy(35,12);
cout<<"X";}
else if (c=='2')
{gotoxy(39,12);
cout<<"X";}
else if (c=='3')
{gotoxy(43,12);
cout<<"X";}
else if (c=='4')
{gotoxy(35,14);
cout<<"X";}
else if (c=='5')
{gotoxy(39,14);
cout<<"X";}
else if (c=='6')
{gotoxy(43,14);
cout<<"X";}
else if (c=='7')
{gotoxy(35,16);
cout<<"X";}
else if (c=='8')
{gotoxy(39,16);
cout<<"X";}
else
{gotoxy(43,16);
cout<<"X";}
gotoxy(16,21);
cout<<" Player 2 : ";
cin>>d;
if (d=='1')
{gotoxy(35,12);
cout<<"O";}
else if (d=='2')
{gotoxy(39,12);
cout<<"O";}
else if (d=='3')
{gotoxy(43,12);
cout<<"O";}
else if (d=='4')
{gotoxy(35,14);
cout<<"O";}
else if (d=='5')
{gotoxy(39,14);
cout<<"O";}
else if (d=='6')
{gotoxy(43,14);
cout<<"O";}
else if (d=='7')
{gotoxy(35,16);
cout<<"O";}
else if (d=='8')
{gotoxy(39,16);
cout<<"O";}
else
{gotoxy(43,16);
cout<<"O";}
gotoxy(31,20);
cout<<" Player 1 : ";
cin>>e;
if (e=='1')
{gotoxy(35,12);
cout<<"X";}
else if (e=='2')
{gotoxy(39,12);
cout<<"X";}
else if (e=='3')
{gotoxy(43,12);
cout<<"X";}
else if (e=='4')
{gotoxy(35,14);
cout<<"X";}
else if (e=='5')
{gotoxy(39,14);
cout<<"X";}
else if (e=='6')
{gotoxy(43,14);
cout<<"X";}
else if (e=='7')
{gotoxy(35,16);
cout<<"X";}
else if (e=='8')
{gotoxy(39,16);
cout<<"X";}
else
{gotoxy(43,16);
cout<<"X";}
if (((a=='1' || a=='2' || a=='3') && (c=='1' || c=='2' || c=='3') && (e=='1' || e=='2' || e=='3')) ||
((a=='4' || a=='5' || a=='6') && (c=='4' || c=='5' || c=='6') && (e=='4' || e=='5' || e=='6')) ||
((a=='7' || a=='8' || a=='9') && (c=='7' || c=='8' || c=='9') && (e=='7' || e=='8' || e=='9')) ||
((a=='1' || a=='4' || a=='7') && (c=='1' || c=='4' || c=='7') && (e=='1' || e=='4' || e=='7')) ||
((a=='2' || a=='5' || a=='8') && (c=='2' || c=='5' || c=='8') && (e=='2' || e=='5' || e=='8')) ||
((a=='3' || a=='6' || a=='9') && (c=='3' || c=='6' || c=='9') && (e=='3' || e=='6' || e=='9')) ||
((a=='1' || a=='5' || a=='9') && (c=='1' || c=='5' || c=='9') && (e=='1' || e=='5' || e=='9')) ||
((a=='3' || a=='5' || a=='7') && (c=='3' || c=='5' || c=='7') && (e=='3' || e=='5' || e=='7')))
{gotoxy(1,23);
cout<<"\t\t\tPlayer 1 Menang!!!\n";
cout<<"Tekan [1] untuk main lagi, dan tekan [2] untuk keluar dari permainan!";
cin>>abc;
if (abc=='1')
{goto atas;}
else
{exit(0);}}
else
{
gotoxy(31,21);
cout<<" Player 2 : ";
cin>>f;
if (f=='1')
{gotoxy(35,12);
cout<<"O";}
else if (f=='2')
{gotoxy(39,12);
cout<<"O";}
else if (f=='3')
{gotoxy(43,12);
cout<<"O";}
else if (f=='4')
{gotoxy(35,14);
cout<<"O";}
else if (f=='5')
{gotoxy(39,14);
cout<<"O";}
else if (f=='6')
{gotoxy(43,14);
cout<<"O";}
else if (f=='7')
{gotoxy(35,16);
cout<<"O";}
else if (f=='8')
{gotoxy(39,16);
cout<<"O";}
else
{gotoxy(43,16);
cout<<"O";}
if (((b=='1' || b=='2' || b=='3') && (d=='1' || d=='2' || d=='3') && (f=='1' || f=='2' || f=='3')) ||
((b=='4' || b=='5' || b=='6') && (d=='4' || d=='5' || d=='6') && (f=='4' || f=='5' || f=='6')) ||
((b=='7' || b=='8' || b=='9') && (d=='7' || d=='8' || d=='9') && (f=='7' || f=='8' || f=='9')) ||
((b=='1' || b=='4' || b=='7') && (d=='1' || d=='4' || d=='7') && (f=='1' || f=='4' || f=='7')) ||
((b=='2' || b=='5' || b=='8') && (d=='2' || d=='5' || d=='8') && (f=='2' || f=='5' || f=='8')) ||
((b=='3' || b=='6' || b=='9') && (d=='3' || d=='6' || d=='9') && (f=='3' || f=='6' || f=='9')) ||
((b=='1' || b=='5' || b=='9') && (d=='1' || d=='5' || d=='9') && (f=='1' || f=='5' || f=='9')) ||
((b=='3' || b=='5' || b=='7') && (d=='3' || d=='5' || d=='7') && (f=='3' || f=='5' || f=='7')))
{gotoxy(1,23);
cout<<"\t\t\tPlayer 2 Menang!!!\n";
cout<<"Tekan [1] untuk main lagi, dan tekan [2] untuk keluar dari permainan!";
cin>>abc;
if (abc=='1')
{goto atas;}
else
{exit(0);}}
else
{
gotoxy(46,20);
cout<<" Player 1 : ";
cin>>g;
if (g=='1')
{gotoxy(35,12);
cout<<"X";}
else if (g=='2')
{gotoxy(39,12);
cout<<"X";}
else if (g=='3')
{gotoxy(43,12);
cout<<"X";}
else if (g=='4')
{gotoxy(35,14);
cout<<"X";}
else if (g=='5')
{gotoxy(39,14);
cout<<"X";}
else if (g=='6')
{gotoxy(43,14);
cout<<"X";}
else if (g=='7')
{gotoxy(35,16);
cout<<"X";}
else if (g=='8')
{gotoxy(39,16);
cout<<"X";}
else
{gotoxy(43,16);
cout<<"X";}
if (((a=='1' || a=='2' || a=='3') && (c=='1' || c=='2' || c=='3') && (g=='1' || g=='2' || g=='3')) ||
((a=='4' || a=='5' || a=='6') && (c=='4' || c=='5' || c=='6') && (g=='4' || g=='5' || g=='6')) ||
((a=='7' || a=='8' || a=='9') && (c=='7' || c=='8' || c=='9') && (g=='7' || g=='8' || g=='9')) ||
((a=='1' || a=='4' || a=='7') && (c=='1' || c=='4' || c=='7') && (g=='1' || g=='4' || g=='7')) ||
((a=='2' || a=='5' || a=='8') && (c=='2' || c=='5' || c=='8') && (g=='2' || g=='5' || g=='8')) ||
((a=='3' || a=='6' || a=='9') && (c=='3' || c=='6' || c=='9') && (g=='3' || g=='6' || g=='9')) ||
((a=='1' || a=='5' || a=='9') && (c=='1' || c=='5' || c=='9') && (g=='1' || g=='5' || g=='9')) ||
((a=='3' || a=='5' || a=='7') && (c=='3' || c=='5' || c=='7') && (g=='3' || g=='5' || g=='7')) ||
((a=='1' || a=='2' || a=='3') && (g=='1' || g=='2' || g=='3') && (e=='1' || e=='2' || e=='3')) ||
((a=='4' || a=='5' || a=='6') && (g=='4' || g=='5' || g=='6') && (e=='4' || e=='5' || e=='6')) ||
((a=='7' || a=='8' || a=='9') && (g=='7' || g=='8' || g=='9') && (e=='7' || e=='8' || e=='9')) ||
((a=='1' || a=='4' || a=='7') && (g=='1' || g=='4' || g=='7') && (e=='1' || e=='4' || e=='7')) ||
((a=='2' || a=='5' || a=='8') && (g=='2' || g=='5' || g=='8') && (e=='2' || e=='5' || e=='8')) ||
((a=='3' || a=='6' || a=='9') && (g=='3' || g=='6' || g=='9') && (e=='3' || e=='6' || e=='9')) ||
((a=='1' || a=='5' || a=='9') && (g=='1' || g=='5' || g=='9') && (e=='1' || e=='5' || e=='9')) ||
((a=='3' || a=='5' || a=='7') && (g=='3' || g=='5' || g=='7') && (e=='3' || e=='5' || e=='7')) ||
((g=='1' || g=='2' || g=='3') && (c=='1' || c=='2' || c=='3') && (e=='1' || e=='2' || e=='3')) ||
((g=='4' || g=='5' || g=='6') && (c=='4' || c=='5' || c=='6') && (e=='4' || e=='5' || e=='6')) ||
((g=='7' || g=='8' || g=='9') && (c=='7' || c=='8' || c=='9') && (e=='7' || e=='8' || e=='9')) ||
((g=='1' || g=='4' || g=='7') && (c=='1' || c=='4' || c=='7') && (e=='1' || e=='4' || e=='7')) ||
((g=='2' || g=='5' || g=='8') && (c=='2' || c=='5' || c=='8') && (e=='2' || e=='5' || e=='8')) ||
((g=='3' || g=='6' || g=='9') && (c=='3' || c=='6' || c=='9') && (e=='3' || e=='6' || e=='9')) ||
((g=='1' || g=='5' || g=='9') && (c=='1' || c=='5' || c=='9') && (e=='1' || e=='5' || e=='9')) ||
((g=='3' || g=='5' || g=='7') && (c=='3' || c=='5' || c=='7') && (e=='3' || e=='5' || e=='7')))
{gotoxy(1,23);
cout<<"\t\t\tPlayer 1 Menang!!!\n";
cout<<"Tekan [1] untuk main lagi, dan tekan [2] untuk keluar dari permainan!";
cin>>abc;
if (abc=='1')
{goto atas;}
else
{exit(0);}}
else
{
gotoxy(46,21);
cout<<" Player 2 : ";
cin>>h;
if (h=='1')
{gotoxy(35,12);
cout<<"O";}
else if (h=='2')
{gotoxy(39,12);
cout<<"O";}
else if (h=='3')
{gotoxy(43,12);
cout<<"O";}
else if (h=='4')
{gotoxy(35,14);
cout<<"O";}
else if (h=='5')
{gotoxy(39,14);
cout<<"O";}
else if (h=='6')
{gotoxy(43,14);
cout<<"O";}
else if (h=='7')
{gotoxy(35,16);
cout<<"O";}
else if (h=='8')
{gotoxy(39,16);
cout<<"O";}
else
{gotoxy(43,16);
cout<<"O";}
if (((b=='1' || b=='2' || b=='3') && (d=='1' || d=='2' || d=='3') && (h=='1' || h=='2' || h=='3')) ||
((b=='4' || b=='5' || b=='6') && (d=='4' || d=='5' || d=='6') && (h=='4' || h=='5' || h=='6')) ||
((b=='7' || b=='8' || b=='9') && (d=='7' || d=='8' || d=='9') && (h=='7' || h=='8' || h=='9')) ||
((b=='1' || b=='4' || b=='7') && (d=='1' || d=='4' || d=='7') && (h=='1' || h=='4' || h=='7')) ||
((b=='2' || b=='5' || b=='8') && (d=='2' || d=='5' || d=='8') && (h=='2' || h=='5' || h=='8')) ||
((b=='3' || b=='6' || b=='9') && (d=='3' || d=='6' || d=='9') && (h=='3' || h=='6' || h=='9')) ||
((b=='1' || b=='5' || b=='9') && (d=='1' || d=='5' || d=='9') && (h=='1' || h=='5' || h=='9')) ||
((b=='3' || b=='5' || b=='7') && (d=='3' || d=='5' || d=='7') && (h=='3' || h=='5' || h=='7')) ||
((b=='1' || b=='2' || b=='3') && (h=='1' || h=='2' || h=='3') && (f=='1' || f=='2' || f=='3')) ||
((b=='4' || b=='5' || b=='6') && (h=='4' || h=='5' || h=='6') && (f=='4' || f=='5' || f=='6')) ||
((b=='7' || b=='8' || b=='9') && (h=='7' || h=='8' || h=='9') && (f=='7' || f=='8' || f=='9')) ||
((b=='1' || b=='4' || b=='7') && (h=='1' || h=='4' || h=='7') && (f=='1' || f=='4' || f=='7')) ||
((b=='2' || b=='5' || b=='8') && (h=='2' || h=='5' || h=='8') && (f=='2' || f=='5' || f=='8')) ||
((b=='3' || b=='6' || b=='9') && (h=='3' || h=='6' || h=='9') && (f=='3' || f=='6' || f=='9')) ||
((b=='1' || b=='5' || b=='9') && (h=='1' || h=='5' || h=='9') && (f=='1' || f=='5' || f=='9')) ||
((b=='3' || b=='5' || b=='7') && (h=='3' || h=='5' || h=='7') && (f=='3' || f=='5' || f=='7')) ||
((h=='1' || h=='2' || h=='3') && (d=='1' || d=='2' || d=='3') && (f=='1' || f=='2' || f=='3')) ||
((h=='4' || h=='5' || h=='6') && (d=='4' || d=='5' || d=='6') && (f=='4' || f=='5' || f=='6')) ||
((h=='7' || h=='8' || h=='9') && (d=='7' || d=='8' || d=='9') && (f=='7' || f=='8' || f=='9')) ||
((h=='1' || h=='4' || h=='7') && (d=='1' || d=='4' || d=='7') && (f=='1' || f=='4' || f=='7')) ||
((h=='2' || h=='5' || h=='8') && (d=='2' || d=='5' || d=='8') && (f=='2' || f=='5' || f=='8')) ||
((h=='3' || h=='6' || h=='9') && (d=='3' || d=='6' || d=='9') && (f=='3' || f=='6' || f=='9')) ||
((h=='1' || h=='5' || h=='9') && (d=='1' || d=='5' || d=='9') && (f=='1' || f=='5' || f=='9')) ||
((h=='3' || h=='5' || h=='7') && (d=='3' || d=='5' || d=='7') && (f=='3' || f=='5' || f=='7')))
{gotoxy(1,23);
cout<<"\t\t\tPlayer 2 Menang!!!\n";
cout<<"Tekan [1] untuk main lagi, dan tekan [2] untuk keluar dari permainan!";
cin>>abc;
if (abc=='1')
{goto atas;}
else
{exit(0);}}
else
{
gotoxy(61,20);
cout<<" Player 1 : ";
cin>>i;
if (i=='1')
{gotoxy(35,12);
cout<<"X";}
else if (i=='2')
{gotoxy(39,12);
cout<<"X";}
else if (i=='3')
{gotoxy(43,12);
cout<<"X";}
else if (i=='4')
{gotoxy(35,14);
cout<<"X";}
else if (i=='5')
{gotoxy(39,14);
cout<<"X";}
else if (i=='6')
{gotoxy(43,14);
cout<<"X";}
else if (i=='7')
{gotoxy(35,16);
cout<<"X";}
else if (i=='8')
{gotoxy(39,16);
cout<<"X";}
else
{gotoxy(43,16);
cout<<"X";}
if (((a=='1' || a=='2' || a=='3') && (c=='1' || c=='2' || c=='3') && (i=='1' || i=='2' || i=='3')) ||
((a=='4' || a=='5' || a=='6') && (c=='4' || c=='5' || c=='6') && (i=='4' || i=='5' || i=='6')) ||
((a=='7' || a=='8' || a=='9') && (c=='7' || c=='8' || c=='9') && (i=='7' || i=='8' || i=='9')) ||
((a=='1' || a=='4' || a=='7') && (c=='1' || c=='4' || c=='7') && (i=='1' || i=='4' || i=='7')) ||
((a=='2' || a=='5' || a=='8') && (c=='2' || c=='5' || c=='8') && (i=='2' || i=='5' || i=='8')) ||
((a=='3' || a=='6' || a=='9') && (c=='3' || c=='6' || c=='9') && (i=='3' || i=='6' || i=='9')) ||
((a=='1' || a=='5' || a=='9') && (c=='1' || c=='5' || c=='9') && (i=='1' || i=='5' || i=='9')) ||
((a=='3' || a=='5' || a=='7') && (c=='3' || c=='5' || c=='7') && (i=='3' || i=='5' || i=='7')) ||
((a=='1' || a=='2' || a=='3') && (i=='1' || i=='2' || i=='3') && (e=='1' || e=='2' || e=='3')) ||
((a=='4' || a=='5' || a=='6') && (i=='4' || i=='5' || i=='6') && (e=='4' || e=='5' || e=='6')) ||
((a=='7' || a=='8' || a=='9') && (i=='7' || i=='8' || i=='9') && (e=='7' || e=='8' || e=='9')) ||
((a=='1' || a=='4' || a=='7') && (i=='1' || i=='4' || i=='7') && (e=='1' || e=='4' || e=='7')) ||
((a=='2' || a=='5' || a=='8') && (i=='2' || i=='5' || i=='8') && (e=='2' || e=='5' || e=='8')) ||
((a=='3' || a=='6' || a=='9') && (i=='3' || i=='6' || i=='9') && (e=='3' || e=='6' || e=='9')) ||
((a=='1' || a=='5' || a=='9') && (i=='1' || i=='5' || i=='9') && (e=='1' || e=='5' || e=='9')) ||
((a=='3' || a=='5' || a=='7') && (i=='3' || i=='5' || i=='7') && (e=='3' || e=='5' || e=='7')) ||
((i=='1' || i=='2' || i=='3') && (c=='1' || c=='2' || c=='3') && (e=='1' || e=='2' || e=='3')) ||
((i=='4' || i=='5' || i=='6') && (c=='4' || c=='5' || c=='6') && (e=='4' || e=='5' || e=='6')) ||
((i=='7' || i=='8' || i=='9') && (c=='7' || c=='8' || c=='9') && (e=='7' || e=='8' || e=='9')) ||
((i=='1' || i=='4' || i=='7') && (c=='1' || c=='4' || c=='7') && (e=='1' || e=='4' || e=='7')) ||
((i=='2' || i=='5' || i=='8') && (c=='2' || c=='5' || c=='8') && (e=='2' || e=='5' || e=='8')) ||
((i=='3' || i=='6' || i=='9') && (c=='3' || c=='6' || c=='9') && (e=='3' || e=='6' || e=='9')) ||
((i=='1' || i=='5' || i=='9') && (c=='1' || c=='5' || c=='9') && (e=='1' || e=='5' || e=='9')) ||
((i=='3' || i=='5' || i=='7') && (c=='3' || c=='5' || c=='7') && (e=='3' || e=='5' || e=='7')) ||
((g=='1' || g=='2' || g=='3') && (c=='1' || c=='2' || c=='3') && (i=='1' || i=='2' || i=='3')) ||
((g=='4' || g=='5' || g=='6') && (c=='4' || c=='5' || c=='6') && (i=='4' || i=='5' || i=='6')) ||
((g=='7' || g=='8' || g=='9') && (c=='7' || c=='8' || c=='9') && (i=='7' || i=='8' || i=='9')) ||
((g=='1' || g=='4' || g=='7') && (c=='1' || c=='4' || c=='7') && (i=='1' || i=='4' || i=='7')) ||
((g=='2' || g=='5' || g=='8') && (c=='2' || c=='5' || c=='8') && (i=='2' || i=='5' || i=='8')) ||
((g=='3' || g=='6' || g=='9') && (c=='3' || c=='6' || c=='9') && (i=='3' || i=='6' || i=='9')) ||
((g=='1' || g=='5' || g=='9') && (c=='1' || c=='5' || c=='9') && (i=='1' || i=='5' || i=='9')) ||
((g=='3' || g=='5' || g=='7') && (c=='3' || c=='5' || c=='7') && (i=='3' || i=='5' || i=='7')) ||
((g=='1' || g=='2' || g=='3') && (i=='1' || i=='2' || i=='3') && (e=='1' || e=='2' || e=='3')) ||
((g=='4' || g=='5' || g=='6') && (i=='4' || i=='5' || i=='6') && (e=='4' || e=='5' || e=='6')) ||
((g=='7' || g=='8' || g=='9') && (i=='7' || i=='8' || i=='9') && (e=='7' || e=='8' || e=='9')) ||
((g=='1' || g=='4' || g=='7') && (i=='1' || i=='4' || i=='7') && (e=='1' || e=='4' || e=='7')) ||
((g=='2' || g=='5' || g=='8') && (i=='2' || i=='5' || i=='8') && (e=='2' || e=='5' || e=='8')) ||
((g=='3' || g=='6' || g=='9') && (i=='3' || i=='6' || i=='9') && (e=='3' || e=='6' || e=='9')) ||
((g=='1' || g=='5' || g=='9') && (i=='1' || i=='5' || i=='9') && (e=='1' || e=='5' || e=='9')) ||
((g=='3' || g=='5' || g=='7') && (i=='3' || i=='5' || i=='7') && (e=='3' || e=='5' || e=='7')) ||
((a=='1' || a=='2' || a=='3') && (g=='1' || g=='2' || g=='3') && (i=='1' || i=='2' || i=='3')) ||
((a=='4' || a=='5' || a=='6') && (g=='4' || g=='5' || g=='6') && (i=='4' || i=='5' || i=='6')) ||
((a=='7' || a=='8' || a=='9') && (g=='7' || g=='8' || g=='9') && (i=='7' || i=='8' || i=='9')) ||
((a=='1' || a=='4' || a=='7') && (g=='1' || g=='4' || g=='7') && (i=='1' || i=='4' || i=='7')) ||
((a=='2' || a=='5' || a=='8') && (g=='2' || g=='5' || g=='8') && (i=='2' || i=='5' || i=='8')) ||
((a=='3' || a=='6' || a=='9') && (g=='3' || g=='6' || g=='9') && (i=='3' || i=='6' || i=='9')) ||
((a=='1' || a=='5' || a=='9') && (g=='1' || g=='5' || g=='9') && (i=='1' || i=='5' || i=='9')) ||
((a=='3' || a=='5' || a=='7') && (g=='3' || g=='5' || g=='7') && (i=='3' || i=='5' || i=='7')))
{gotoxy(1,23);
cout<<"\t\t\tPlayer 1 Menang!!!\n";
cout<<"Tekan [1] untuk main lagi, dan tekan [2] untuk keluar dari permainan!";
cin>>abc;
if (abc=='1')
{goto atas;}
else
{exit(0);}}
else
{
gotoxy(1,23);
cout<<"\t\t\tPermainan Imbang!!!\n";
cout<<"Tekan [1] untuk main lagi, dan tekan [2] untuk keluar dari permainan!";
cin>>abc;
if (abc=='1')
{goto atas;}
else
{exit(0);}}}}}}}
getch();
}
KALKULATOR SEDERHAN C++
#include <iostream.h>
#include <conio.h>
#include <math.h>
#include <stdlib.h>
main()
{
int a, e, f;
char d;
float b, c, hasil;
atas:
clrscr();
cout<<"\t Program Kalkulator Sederhana\n";
cout<<"\t==============================\n\n";
cout<<" 1. Tambah\n";
cout<<" 2. Kurang\n";
cout<<" 3. Kali\n";
cout<<" 4. Bagi\n";
cout<<" 5. Pangkat\n";
cout<<" 6. Akar\n";
cout<<" 7. Sinus\n";
cout<<" 8. Cosinus\n";
cout<<" 9. Tangens\n";
cout<<" 10. Log\n";
cout<<" 11. Modulus\n";
cout<<" 12. Ln\n\n";
cout<<" Pilih Operator : ";
cin>>a;
cout<<endl;
if (a==1)
{
cout<<" Input Angka Pertama : ";
cin>>b;
cout<<" Input Angka Kedua : ";
cin>>c;
hasil=b+c;
cout<<"\n "<<b<<" + "<<c<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==2)
{
cout<<" Input Angka Pertama : ";
cin>>b;
cout<<" Input Angka Kedua : ";
cin>>c;
hasil=b-c;
cout<<"\n "<<b<<" - "<<c<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==3)
{
cout<<" Input Angka Pertama : ";
cin>>b;
cout<<" Input Angka Kedua : ";
cin>>c;
hasil=b*c;
cout<<"\n "<<b<<" x "<<c<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==4)
{
cout<<" Input Angka Pertama : ";
cin>>b;
cout<<" Input Angka Kedua : ";
cin>>c;
hasil=b/c;
cout<<"\n "<<b<<" : "<<c<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==5)
{
cout<<" Input Angka : ";
cin>>b;
cout<<" Input Pangkat : ";
cin>>c;
hasil=pow(b,c);
cout<<"\n "<<b<<"^"<<c<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==6)
{
cout<<" Input Angka : ";
cin>>b;
hasil=sqrt(b);
cout<<"\n Akar "<<b<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==7)
{
cout<<" Input Sudut : ";
cin>>b;
hasil= sin(b/57.2958);
cout<<"\n Sin "<<b<<" Derajat = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==8)
{
cout<<" Input Sudut : ";
cin>>b;
hasil=cos(b/57.2958);
cout<<"\n Cos "<<b<<" Derajat = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==9)
{
cout<<" Input Sudut : ";
cin>>b;
hasil=tan(b/57.2958);
cout<<"\n Tan "<<b<<" Derajat = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==10)
{
cout<<" Input Angka : ";
cin>>b;
hasil=log10(b);
cout<<"\n Log "<<b<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==11)
{
cout<<" Input Angka Pertama : ";
cin>>e;
cout<<" Input Angka Kedua : ";
cin>>f;
hasil= e % f;
cout<<"\n "<<e<<" % "<<f<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==12)
{
cout<<" Input Angka : ";
cin>>b;
hasil=log(b);
cout<<"\n Ln "<<b<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan [T] Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else
{
goto atas;
}
getch();
}
#include <conio.h>
#include <math.h>
#include <stdlib.h>
main()
{
int a, e, f;
char d;
float b, c, hasil;
atas:
clrscr();
cout<<"\t Program Kalkulator Sederhana\n";
cout<<"\t==============================\n\n";
cout<<" 1. Tambah\n";
cout<<" 2. Kurang\n";
cout<<" 3. Kali\n";
cout<<" 4. Bagi\n";
cout<<" 5. Pangkat\n";
cout<<" 6. Akar\n";
cout<<" 7. Sinus\n";
cout<<" 8. Cosinus\n";
cout<<" 9. Tangens\n";
cout<<" 10. Log\n";
cout<<" 11. Modulus\n";
cout<<" 12. Ln\n\n";
cout<<" Pilih Operator : ";
cin>>a;
cout<<endl;
if (a==1)
{
cout<<" Input Angka Pertama : ";
cin>>b;
cout<<" Input Angka Kedua : ";
cin>>c;
hasil=b+c;
cout<<"\n "<<b<<" + "<<c<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==2)
{
cout<<" Input Angka Pertama : ";
cin>>b;
cout<<" Input Angka Kedua : ";
cin>>c;
hasil=b-c;
cout<<"\n "<<b<<" - "<<c<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==3)
{
cout<<" Input Angka Pertama : ";
cin>>b;
cout<<" Input Angka Kedua : ";
cin>>c;
hasil=b*c;
cout<<"\n "<<b<<" x "<<c<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==4)
{
cout<<" Input Angka Pertama : ";
cin>>b;
cout<<" Input Angka Kedua : ";
cin>>c;
hasil=b/c;
cout<<"\n "<<b<<" : "<<c<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==5)
{
cout<<" Input Angka : ";
cin>>b;
cout<<" Input Pangkat : ";
cin>>c;
hasil=pow(b,c);
cout<<"\n "<<b<<"^"<<c<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==6)
{
cout<<" Input Angka : ";
cin>>b;
hasil=sqrt(b);
cout<<"\n Akar "<<b<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==7)
{
cout<<" Input Sudut : ";
cin>>b;
hasil= sin(b/57.2958);
cout<<"\n Sin "<<b<<" Derajat = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==8)
{
cout<<" Input Sudut : ";
cin>>b;
hasil=cos(b/57.2958);
cout<<"\n Cos "<<b<<" Derajat = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==9)
{
cout<<" Input Sudut : ";
cin>>b;
hasil=tan(b/57.2958);
cout<<"\n Tan "<<b<<" Derajat = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==10)
{
cout<<" Input Angka : ";
cin>>b;
hasil=log10(b);
cout<<"\n Log "<<b<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==11)
{
cout<<" Input Angka Pertama : ";
cin>>e;
cout<<" Input Angka Kedua : ";
cin>>f;
hasil= e % f;
cout<<"\n "<<e<<" % "<<f<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan Enter Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else if (a==12)
{
cout<<" Input Angka : ";
cin>>b;
hasil=log(b);
cout<<"\n Ln "<<b<<" = "<<hasil;
cout<<"\n\n Apakah Anda Ingin Menghitung Lagi?\n";
cout<<" Tekan [Y] Untuk Menghitung Lagi.\n";
cout<<" Tekan [T] Untuk Menutup Program.";
d=getche();
if (d == 'Y' || d == 'y')
{
goto atas;
}
else
{
exit(0);
}
}
else
{
goto atas;
}
getch();
}
Minggu, 13 Oktober 2013
PROGRAM BUBLE SHORT ASCENDING C++
//---------------------------------------------------------------------------
#pragma hdrstop
#include <iostream.h>
//---------------------------------------------------------------------------
#pragma argsused
void main()
{
int A[100];
int
c=1,i,j,k,p,x,data,idata;
cout << "Program Buble Short\n";
cout <<
"=====================\n\n";
cout << "masukan jumlah data(max.
100) : ";
cin >> data;
for (idata=0;idata<data;idata++)
{
cout << "Masukan data ke-"
<< idata+1 << " : ";
cin >> A[idata];
}
cout << "\nData sebelum di urutkan \n";
for (p=0;p<data;p++)
{
cout << A[p] << " ";
}
// Aval proses sorting
do{
x=0;
for (i=0;i<data-1;i++)
{
if (A[i] > A[i+1])
{
k=A[i];
A[i]=A[i+1];
A[i+1]=k;
x++;
}
}
cout << "\n\nLangkah-"<< c << "\n";
for (int p=0;p<data;p++)
{
cout << A[p] << " ";
}
c++;
}while (x>0);
// akhir proses ascending sorting
cout <<"\n\n";
system("pause");
}
PROGRAM BUBLE SHORT DESCENDING C++
// ------------------------------- ------------------------------ --------------
#pragma hdrstop
#include <iostream.h>
// ------------------------------- ------------------------------ --------------
#pragma argsused
void main()
{
int A[100];
int c=1,i,j,k,p,x,data,idata;
cout<< "PRORAM BUBLE SHORT\n";
cout<< "======================\n\n";
cout << "Masukan Jumlah Data (max. 10) : ";
cin>> data;
for (idata=0;idata<data;idata++)
{
cout << "Masukan Data Ke- " << idata+1 << " : ";
cin >> A[idata];
}
cout << "\nData sebelum diurutkan\n";
for (p=0;p<data;p++)
{ cout << A[p] << " ";
}
// awal proses pengurutan
do{
x=0;
for (i=0;i<data-1;i++){
if (A[i] < A[i+1]){
k=A[i];
A[i]=A[i+1];
A[i+1]=k;
x++;
}
}
cout << "\n\nLangkah-" << c << "\n";
for ( int p=0;p<data;p++){
cout << A[p] << " ";
}
c++;
} while (x>0);
// akhir proses sorting descending
cout << "\n\n";
system ("pause");
}
// ------------------------------- ------------------------------ --------------
#pragma hdrstop
#include <iostream.h>
//
#pragma argsused
void main()
{
int A[100];
int c=1,i,j,k,p,x,data,idata;
cout<< "PRORAM BUBLE SHORT\n";
cout<< "======================\n\n";
cout << "Masukan Jumlah Data (max. 10) : ";
cin>> data;
for (idata=0;idata<data;idata++)
{
cout << "Masukan Data Ke- " << idata+1 << " : ";
cin >> A[idata];
}
cout << "\nData sebelum diurutkan\n";
for (p=0;p<data;p++)
{ cout << A[p] << " ";
}
// awal proses pengurutan
do{
x=0;
for (i=0;i<data-1;i++){
if (A[i] < A[i+1]){
k=A[i];
A[i]=A[i+1];
A[i+1]=k;
x++;
}
}
cout << "\n\nLangkah-" << c << "\n";
for ( int p=0;p<data;p++){
cout << A[p] << " ";
}
c++;
} while (x>0);
// akhir proses sorting descending
cout << "\n\n";
system ("pause");
}
//
Langganan:
Postingan (Atom)