WarTurks Yazılım&Programlama
Yazılım&Programlama  
  Ana Sayfa
  Paralı Hizmetlerimiz
  Visual Basic'e Giris
  VB İndirmeli Dersler[Artık Tüm Dersler Burda]]
  Visual Basic 6 Dersleri
  Visual Basic 6 Dersleri 2
  Visual Basic Ders Notlari[Resimli]
  Pascala Giris
  Pascal Dersleri
  Php'ye Giris
  Php Dersleri
  C ve C++'ya Giris
  C ve C++ Dersleri
  C++ Ders Notlari [Resimli]
  İletişim
C ve C++ Dersleri
Progressbar Kullanımı

form_load
progressbar1.maximum=100
progressbar1.minimum=0
progressbar1.step=2

button1_click
timer1.
Stop

button2_click
timer1.
Stop

timer1._click
If(i=0)
Then
If
(progressbar1.value>=100)
Then
i=1
Else
progressbar1.value=progressbar1.value+5
End
If
Else
If(i=1)
Then
i=0
Else
progressbar1.value=progressbar1.value-5
End
If
End
If
----------------------------------------------------------
Karekök Bulma

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    float  a,b;
   
    cout<<"Bir Sayi Giriniz  :  ";
    cin>>a;
   
    b = a * a;
   
    cout<<"Girdiginiz Sayinin Karekökü  :  ";
    cout<<b<<endl;
   
    system("PAUSE");
    return EXIT_SUCCESS;
}
----------------------------------------------------------------------
C++ İle Yazıyı Tersten Yazma

codeDivStart()
#include
void request(void);
void response(void);
void try_again(void);

int main() {
cout << "Created By MTDesign - yns@hotmail.com" << endl
<< "THE OPPOSITE OF THE WORD" << endl
<< endl;
request();
response();
try_again();
}

void request(void) {
char text[100];
cout << "------------------------" << endl;
cout << "Please Enter a Word : ";
cin .................................................................... text;
}

void response(void) {
char text[100];
int i;
cout << "Opposite : ";
for (i=strlen(text); i>=0; i--) {
cout << text;
}
cout << "n------------------------" << endl;
}

void try_again(void) {
char quest;
cout << "nTry Again ... ? E/H : ";
cin .................................................................... quest;
if (quest=='E' || quest=='e')
main();
}
------------------------------------------------------------------------------
Öğrencinin aldığı nota göre durumunu mesajla bildiren program

Öncelıkle 2 öğrenci notu girilecek daha sonra ortalması alınıcak ve ortalmaya göre öğrenci durmu bildirilecek

#include<stdio.h>
#include<conio.h>

int n1,n2;

float ort;

{clrscr()

printf("birinci notu giriniz");

scanf("%d",&n1);

printf("ikinci notu girniz....");

scanf("%d",&n2);

ort=(n1+n2)/2

printf("ortlama=%f",ort);

if( ort>=0) ; & (ort<=24);

printf("çok zayıf");

else if (ort>=25);&(ort<=44);

printf("zayıf ");

else if(ort>=45);&(ort<=54);

printf("gecer");

else if(ort>=55);&(ort<=69);

printf("orta");

else if(ort>=70);&(ort<=84);

printf("iyi");

else if("ort>=85); &(ort<=100);

printf("pekiyi");

else

printf("yanlıs not girdiniz");

getch();

}
------------------------------------------------------------
Titreyen Form Yapma

İLK ÖNCE forma nesnelerimizi ekliyoruz...
1 Tane Timer
Aşagıdaki Kodları Class'a yerleştirin...

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Interval = 150
        Timer1.Start()
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Me.Top = Me.Top + 50
        Me.Top = Me.Top - 50
        Me.Left = Me.Left - 50
        Me.Left = Me.Top + 50
    End Sub
End Class
----------------------------------------------------------------
C++ Dama Oyunu Yapma
C++ Dama Oyunu Yapımı

#include<iostream.h>
#include<windows.h>
#include<stdlib.h>
#include<iomanip.h>
#include <conio.h>

#define YES 1
#define NO 0
#define PLAYER1 1
#define PLAYER2 2
#define ENTER 13
#define SPACE 32
#define BACK 8
#define ESC 0x1b
#define UP 0x48
#define DOWN 0x50
#define LEFT 0x4b
#define RIGHT 0x4d
#define F1 0x3b
#define F2 0x3c
#define F3 0x3d
#define F4 0x3e
#define F5 0x3f
#define F6 0x40
#define F7 0x41
#define F8 0x42
#define F9 0x43
#define F10 0x44

enum Colors
{
BLACK,
BLUE,
GREEN,
TEAL,
MAROON,
PURPLE,
MUSTARD,
LIGHT_GRAY,
GRAY,
BRIGHT_BLUE,
LIME,
LIGHT_BLUE,
RED,
FUCHSIA,
YELLOW,
WHITE
};
void setcolor(int, int);
void resetboard(char[][7]);
void resetbool(bool [][7], bool [][7], bool [][7]);
void viewchar();
void displayboard(char[][7], bool[][7], bool[][7], char[], const int, const int);
int getboard(char[][7], bool [][7], bool[][7], bool[][7], char[], const int, const int);
void falling(char[][7], bool[][7], bool[][7], bool[][7], int, char[], int, const int);
int win(bool [][7], bool [][7]);
void winningboard(char[][7], bool[][7], bool[][7]);

main()
{
setcolor(BLACK, WHITE);
system("cls");

//size of the name arrays
const int size=50;
//BOOLEAN DOUBLE SUBSCRIPTED ARRAY
//keeps track of reds positions on the board
bool redboolboard[6][7];
//keeps track of blues positions on the board
bool blueboolboard[6][7];
//an array of the star charcters
bool cboard[6][7];

//CHARCTER ARRAYS
//player one's name
char playerone[size]={''};
//player two's name
char playertwo[size]={''};
//a string of star charcters
char board[6][7];

//BOOLEAN VARIABLES
//to stop a for loop
bool stop;
//to quit the game
bool quit;

//INTERGERS
//the position of the piece that will fall
int arrowpos=0;
//the value getboard returns
int number;
//in the for loop to convert names to uppercase
int d;
//to see if you want to continue
int yesorno;
//in the for loop to determine the pieces position
int x;

cout<<"Player one enter your name:"<<endl;
cin.getline(playerone, size);
system("cls");
cout<<"Player two enter your name:"<<endl;
cin.getline(playertwo, size);
system("cls");
while (1)
{
system("cls");
quit=false;
arrowpos=0;
resetboard(board);
resetbool(blueboolboard, redboolboard, cboard);
cout<<"PRESS ESCAPE AT ANY TIME TO QUIT"<<endl<<endl;
system("pause");
system("cls");
while (quit==false)
{
if(win(redboolboard, blueboolboard)!=0)
{
quit=true;
}
if (quit==false)
{
number=getboard(board, cboard, blueboolboard, redboolboard, playerone, size, PLAYER1);
stop=false;
}
else
{
number=8;
}
if (number==8)
{
quit=true;
}
else
{
system("cls");
if (cboard[5][number]==false)
{
falling(board, redboolboard, blueboolboard, cboard, number, playerone, size, PLAYER1);
cboard[5][number]=true;
system("cls");
redboolboard[5][number]=true;
}
else if(cboard[0][number]!=true)
{
for (x=4; x>=0; x--)
{
if (stop==false)
{
if (cboard[x][number]!=true)
{
falling(board, redboolboard, blueboolboard, cboard, number, playerone, size, PLAYER1);
redboolboard[x][number]=true;
system("cls");
cboard[x][number]=true;
stop=true;
}
}
}
}
}
//RED'S TURN
stop=false;
if (win(redboolboard, blueboolboard)!=0)
{
quit=true;
}
else if(quit!=true)
{
number=getboard(board, cboard, blueboolboard, redboolboard, playertwo, size, PLAYER2);
if (number==8 || win(redboolboard, blueboolboard)!=0)
{
quit=true;
}
if (quit==false)
{
if (cboard[5][number]==false)
{
falling(board, redboolboard, blueboolboard, cboard, number, playertwo, size, PLAYER2);
cboard[5][number]=true;
system("cls");
blueboolboard[5][number]=true;
}
else
{
for (x=4; x>=0; x--)
{
if (stop==false)
{
if (cboard[x][number]!=true)
{
falling(board, redboolboard, blueboolboard, cboard,number, playertwo, size, PLAYER2);
blueboolboard[x][number]=true;
cboard[x][number]=true;
system("cls");
stop=true;
}
}
}
}
}
}
}
system("cls");
winningboard(board, blueboolboard, redboolboard);
if (win(redboolboard, blueboolboard)==1)
{
for (d=0; d<size, playerone[d]!=''; d++)
{
//all caps
if (playerone[d]<=122 && playerone[d]>=97)
playerone[d]-=32;
cout<<playerone[d];
}
cout<<" WINS!!!";
}
else if (win(redboolboard, blueboolboard)==2)
{
for (d=0; d<size, playertwo[d]!=''; d++)
{
//all caps
if (playertwo[d]<=122 && playertwo[d]>=97)
playertwo[d]-=32;
cout<<playertwo[d];
}
cout<<" WINS!!!";
}
else
{
cout<<"it's a tie";
}
cout<<endl;
cout<<"PLAY AGAIN?n1=NOn2=YES"<<endl;
cin>>yesorno;
yesorno--;
if (yesorno==NO)
{
exit(1);
}
}
return 0;
}
void setcolor (int background, int letter)
{
int color=background*16+letter;
cout<<flush;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HA NDLE), color);
}
void viewchar()
{
char letter;
system("cls");
for (int x=0; x<=255; x++)
{
letter=x;
cout<<x<<": "<<letter<<"t";
if(x%6==0)
{
cout<<endl;
}
}
system("pause");
}

void set_color (int background, int letter)
{
int color=background*16+letter;
cout<<flush;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HA NDLE), color);
}
void resetboard(char board[][7])
{
for (int row=0; row<6; row++)
{
for (int collumn=0; collumn<7; collumn++)
{
board[row][collumn]=15;
}
}
}
int getboard(char board [][7], bool cboard[][7], bool blueboolboard[][7], bool redboolboard[][7], char name[], const int num, const int who)
{
char letter;
char arrow[7]={' ',' ',' ',' ',' ',' ',' '};
int arrowpos;
int t;
displayboard(board, blueboolboard, redboolboard, name, num, who);

int r=0;
for (r; r<7; r++)
{
if (cboard[0][r]==false)
{
arrow[r]=15;
arrowpos=r;
break;
}
if (r==6 && cboard[0][6]==true)
{
return 8;
}
}
while (t!=13 && t!=27)
{
t=getch();
system("cls");
for (int a=0; a<20, name[a]+=''; a++)
{
cout<<name[a];
}
cout<<endl<<endl<<endl;
if (t==LEFT)
{
if (arrowpos!=0)
{
if (cboard[0][arrowpos-1]==false)
{
arrow[arrowpos]=' ';
arrowpos--;
arrow[arrowpos]=15;
}
else
{
for (int i=arrowpos-1; i>=0; i--)
{
if (cboard[0][i]==false)
{
arrow[i]=15;
arrow[arrowpos]=' ';
arrowpos=i;
break;
}
}
}

}
}
else if (t==RIGHT)
{
if (arrowpos!=6)
{
if (cboard[0][arrowpos+1]==false)
{
arrow[arrowpos]=' ';
arrowpos++;
arrow[arrowpos]=15;
}
else
{
for (int i=arrowpos+1; i<7; i++)
{
if (cboard[0][i]==false)
{
arrow[i]=15;
arrow[arrowpos]=' ';
arrowpos=i;
break;
}
}
}
}
}
cout<<" ";
setcolor(BLACK, LIME);
for (int w=0; w<7; w++)
{
if (who==PLAYER1)
{
setcolor(BLACK, RED);
}
else
{
setcolor(BLACK, LIGHT_BLUE);
}
cout<<arrow[w]<<' ';
}
setcolor(BLACK, WHITE);
cout<<endl;
for (int x=0; x<6; x++)
{
cout<<setw(5);
for (int y=0; y<7; y++)
{
if (blueboolboard[x][y])
{
setcolor(BLACK, LIGHT_BLUE);
cout<<board[x][y]<<' ';
setcolor(BLACK, WHITE);
}
else if (redboolboard[x][y])
{
setcolor(BLACK, RED);
cout<<board[x][y]<<' ';
setcolor(BLACK, WHITE);
}
else
{
setcolor(BLACK, YELLOW);
cout<<board[x][y]<<' ';
setcolor(BLACK, WHITE);
}
}
cout<<endl;
}
setcolor(BLACK, BRIGHT_BLUE);
letter=219;
cout<<" "<<letter<<" "<<letter<<endl;
letter=30;
cout<<endl;
setcolor(BLACK, WHITE);
}
if (t!=27)
return arrowpos;
else
return 8;
}
void resetbool (bool blueboolboard[][7], bool redboolboard[][7], bool cboard[][7])
{
for (int x=0; x<6; x++)
{
for (int y=0; y<7; y++)
{
blueboolboard[x][y]=false;
redboolboard[x][y]=false;
cboard[x][y]=false;
}
}
}
void falling(char board[][7], bool redboolboard[][7], bool blueboolboard[][7], bool cboard[][7], int num, char name[], int number, const int who)
{
char letter;
int stop;
if (cboard[5][num]==false)
stop=5;
else
{
for (int q=4; q>=0; q--)
{
if (cboard[q][num]==false)
{
stop=q;
break;
}
}
}
for (int r=0; r<=stop; r++)
{
system("cls");
for (int a=0; a<20, name[a]!=''; a++)
{
cout<<name[a];
}
cerr<<endl<<endl<<endl<<endl;
if (who==PLAYER1)
{
redboolboard[r][num]=true;
}
if (who==PLAYER2)
{
blueboolboard[r][num]=true;
}
for (int x=0; x<6; x++)
{
cerr<<setw(5);
for (int y=0; y<7; y++)
{
if (blueboolboard[x][y])
{
setcolor(BLACK, LIGHT_BLUE);
cerr<<board[x][y]<<' ';
setcolor(BLACK, WHITE);
}
else if (redboolboard[x][y])
{
setcolor(BLACK, RED);
cerr<<board[x][y]<<' ';
setcolor(BLACK, WHITE);
}
else
{
setcolor(BLACK, YELLOW);
cerr<<board[x][y]<<' ';
setcolor(BLACK, WHITE);
}
}
cerr<<endl;
}
if (who==PLAYER1)
{
redboolboard[r][num]=false;
}
if (who==PLAYER2)
{
blueboolboard[r][num]=false;
}
setcolor(BLACK, BRIGHT_BLUE);
letter=219;
cout<<" "<<letter<<" "<<letter<<endl;
letter=30;
cout<<endl;
setcolor(BLACK, WHITE);
cout<<endl;
Sleep(100);
}
}
void displayboard(char board [][7], bool blueboolboard[][7], bool redboolboard[][7], char name[], const int size, const int who)
{
char letter=15;
char arrow[7]={' ',' ',' ',' ',' ',' ',' '};
for (int a=0; a<20, name[a]!=''; a++)
cout<<name[a];
cout<<endl;
cout<<endl<<endl;
for (int i=0; i<7; i++)
{
if (redboolboard[0][i]==false && blueboolboard[0][i]==false)
{
arrow[i]=15;
break;
}
}
if (who==PLAYER1)
{
setcolor(BLACK, RED);
}
else if (who==PLAYER2)
{
setcolor(BLACK, LIGHT_BLUE);
}
cout<<" ";
for (int u=0; u<7; u++)
{
cout<<arrow[u]<<' ';
}
cout<<endl;
setcolor(BLACK, WHITE);
for (int x=0; x<6; x++)
{
cout<<setw(5);
for (int y=0; y<7; y++)
{
if (blueboolboard[x][y])
{
setcolor(BLACK, LIGHT_BLUE);
cout<<board[x][y]<<' ';
setcolor(BLACK, WHITE);
}
else if (redboolboard[x][y])
{
setcolor(BLACK, RED);
cout<<board[x][y]<<' ';
setcolor(BLACK, WHITE);
}
else
{
setcolor(BLACK, YELLOW);
cout<<board[x][y]<<' ';
setcolor(BLACK, WHITE);
}
}
cout<<endl;
}
setcolor(BLACK, BRIGHT_BLUE);
letter=219;
cout<<" "<<letter<<" "<<letter<<endl;
letter=30;
cout<<endl;
setcolor(BLACK, WHITE);
}
int win(bool redboard [][7], bool blueboard [][7])
{
//int win1, win2, win3, win4;
//this is gona be a pain
//across
//1
if (redboard[0][0]==true && redboard[0][1]==true &&redboard[0][2]==true &&redboard[0][3]==true)
{
return PLAYER1;
}
if (blueboard[0][0]==true && blueboard[0][1]==true &&blueboard[0][2]==true &&blueboard[0][3]==true)
{
return PLAYER2;
}
//2
if (redboard[0][1]==true && redboard[0][2]==true &&redboard[0][3]==true &&redboard[0][4]==true)
{
return PLAYER1;
}
if (blueboard[0][1]==true && blueboard[0][2]==true &&blueboard[0][3]==true &&blueboard[0][4]==true)
{
return PLAYER2;
}
//3
if (redboard[0][2]==true && redboard[0][3]==true &&redboard[0][4]==true &&redboard[0][5]==true)
{
return PLAYER1;
}
if (blueboard[0][2]==true && blueboard[0][3]==true &&blueboard[0][4]==true &&blueboard[0][5]==true)
{
return PLAYER2;
}
//4
if (redboard[0][3]==true && redboard[0][4]==true &&redboard[0][5]==true &&redboard[0][6]==true)
{
return PLAYER1;
}
if (blueboard[0][3]==true && blueboard[0][4]==true &&blueboard[0][5]==true &&blueboard[0][6]==true)
{
return PLAYER2;
}
//5
if (redboard[1][0]==true && redboard[1][1]==true &&redboard[1][2]==true &&redboard[1][3]==true)
{
return PLAYER1;
}
if (blueboard[1][0]==true && blueboard[1][1]==true &&blueboard[1][2]==true &&blueboard[1][3]==true)
{
return PLAYER2;
}
//6
if (redboard[1][1]==true && redboard[1][2]==true &&redboard[1][3]==true &&redboard[1][4]==true)
{
return PLAYER1;
}
if (blueboard[1][1]==true && blueboard[1][2]==true &&blueboard[1][3]==true &&blueboard[1][4]==true)
{
return PLAYER2;
}
//7
if (redboard[1][2]==true && redboard[1][3]==true &&redboard[1][4]==true &&redboard[1][5]==true)
{
return PLAYER1;
}
if (blueboard[1][2]==true && blueboard[1][3]==true &&blueboard[1][4]==true &&blueboard[1][5]==true)
{
return PLAYER2;
}
//8
if (redboard[1][3]==true && redboard[1][4]==true &&redboard[1][5]==true &&redboard[1][6]==true)
{
return PLAYER1;
}
if (blueboard[1][3]==true && blueboard[1][4]==true &&blueboard[1][4]==true &&blueboard[1][5]==true)
{
return PLAYER2;
}
//9
if (redboard[2][0]==true && redboard[2][1]==true &&redboard[2][2]==true &&redboard[2][3]==true)
{
return PLAYER1;
}
if (blueboard[2][0]==true && blueboard[2][1]==true &&blueboard[2][2]==true &&blueboard[2][3]==true)
{
return PLAYER2;
}
//10
if (redboard[2][1]==true && redboard[2][2]==true &&redboard[2][3]==true &&redboard[2][4]==true)
{
return PLAYER1;
}
if (blueboard[2][1]==true && blueboard[2][2]==true &&blueboard[2][3]==true &&blueboard[2][4]==true)
{
return PLAYER2;
}
//11
if (redboard[2][2]==true && redboard[2][3]==true &&redboard[2][4]==true &&redboard[2][5]==true)
{
return PLAYER1;
}
if (blueboard[2][2]==true && blueboard[2][3]==true &&blueboard[2][4]==true &&blueboard[2][5]==true)
{
return PLAYER2;
}
//12
if (redboard[2][3]==true && redboard[2][4]==true &&redboard[2][5]==true &&redboard[2][6]==true)
{
return PLAYER1;
}
if (blueboard[2][3]==true && blueboard[2][4]==true &&blueboard[2][5]==true &&blueboard[2][6]==true)
{
return PLAYER2;
}
//13
if (redboard[3][0]==true && redboard[3][1]==true &&redboard[3][2]==true &&redboard[3][3]==true)
{
return PLAYER1;
}
if (blueboard[3][0]==true && blueboard[3][1]==true &&blueboard[3][2]==true &&blueboard[3][3]==true)
{
return PLAYER2;
}
//14
if (redboard[3][1]==true && redboard[3][2]==true &&redboard[3][3]==true &&redboard[3][4]==true)
{
return PLAYER1;
}
if (blueboard[2][1]==true && blueboard[3][2]==true &&blueboard[3][3]==true &&blueboard[3][4]==true)
{
return PLAYER2;
}
//15
if (redboard[3][2]==true && redboard[3][3]==true &&redboard[3][4]==true &&redboard[3][5]==true)
{
return PLAYER1;
}
if (blueboard[3][2]==true && blueboard[3][3]==true &&blueboard[3][4]==true &&blueboard[3][5]==true)
{
return PLAYER2;
}
//16
if (redboard[3][3]==true && redboard[3][4]==true &&redboard[2][5]==true &&redboard[2][6]==true)
{
return PLAYER1;
}
if (blueboard[3][3]==true && blueboard[3][4]==true &&blueboard[2][5]==true &&blueboard[2][6]==true)
{
return PLAYER2;
}
//17
if (redboard[4][0]==true && redboard[4][1]==true &&redboard[4][2]==true &&redboard[4][3]==true)
{
return PLAYER1;
}
if (blueboard[4][0]==true && blueboard[4][1]==true &&blueboard[4][2]==true &&blueboard[4][3]==true)
{
return PLAYER2;
}
//18
if (redboard[4][1]==true && redboard[4][2]==true &&redboard[4][3]==true &&redboard[4][4]==true)
{
return PLAYER1;
}
if (blueboard[4][1]==true && blueboard[4][2]==true &&blueboard[4][3]==true &&blueboard[4][4]==true)
{
return PLAYER2;
}
//19
if (redboard[4][2]==true && redboard[4][3]==true &&redboard[4][4]==true &&redboard[4][5]==true)
{
return PLAYER1;
}
if (blueboard[4][2]==true && blueboard[4][3]==true &&blueboard[4][4]==true &&blueboard[4][5]==true)
{
return PLAYER2;
}
//20
if (redboard[4][3]==true && redboard[4][4]==true &&redboard[4][5]==true &&redboard[4][6]==true)
{
return PLAYER1;
}
if (blueboard[4][3]==true && blueboard[4][4]==true &&blueboard[4][5]==true &&blueboard[4][6]==true)
{
return PLAYER2;
}
//21
if (redboard[5][0]==true && redboard[5][1]==true &&redboard[5][2]==true &&redboard[5][3]==true)
{
return PLAYER1;
}
if (blueboard[5][0]==true && blueboard[5][1]==true &&blueboard[5][2]==true &&blueboard[5][3]==true)
{
return PLAYER2;
}
//22
if (redboard[5][1]==true && redboard[5][2]==true &&redboard[5][3]==true &&redboard[5][4]==true)
{
return PLAYER1;
}
if (blueboard[5][1]==true && blueboard[5][2]==true &&blueboard[5][3]==true &&blueboard[5][4]==true)
{
return PLAYER2;
}
//23
if (redboard[5][2]==true && redboard[5][3]==true &&redboard[5][4]==true &&redboard[5][5]==true)
{
return PLAYER1;
}
if (blueboard[5][2]==true && blueboard[5][3]==true &&blueboard[5][4]==true &&blueboard[5][5]==true)
{
return PLAYER2;
}
//24
if (redboard[5][3]==true && redboard[5][4]==true &&redboard[5][5]==true &&redboard[5][6]==true)
{
return PLAYER1;
}
if (blueboard[5][3]==true && blueboard[5][4]==true &&blueboard[5][5]==true &&blueboard[5][6]==true)
{
return PLAYER2;
}

//down
//25
if (redboard[0][0]==true && redboard[1][0]==true && redboard[2][0]==true && redboard[3][0]==true)
{
return PLAYER1;
}
if (blueboard[0][0]==true && blueboard[1][0]==true && blueboard[2][0]==true && blueboard[3][0]==true)
{
return PLAYER2;
}
//26
if (redboard[1][0]==true && redboard[2][0]==true && redboard[3][0]==true && redboard[4][0]==true)
{
return PLAYER1;
}
if (blueboard[1][0]==true && blueboard[2][0]==true && blueboard[3][0]==true && blueboard[4][0]==true)
{
return PLAYER2;
}
//27
if (redboard[2][0]==true && redboard[3][0]==true && redboard[4][0]==true && redboard[5][0]==true)
{
return PLAYER1;
}
if (blueboard[2][0]==true && blueboard[3][0]==true && blueboard[4][0]==true && blueboard[5][0]==true)
{
return PLAYER2;
}
//28
if (redboard[0][1]==true && redboard[1][1]==true && redboard[2][1]==true && redboard[3][1]==true)
{
return PLAYER1;
}
if (blueboard[0][1]==true && blueboard[1][1]==true && blueboard[2][1]==true && blueboard[3][1]==true)
{
return PLAYER2;
}
//29
if (redboard[1][1]==true && redboard[2][1]==true && redboard[3][1]==true && redboard[4][1]==true)
{
return PLAYER1;
}
if (blueboard[1][1]==true && blueboard[2][1]==true && blueboard[3][1]==true && blueboard[4][1]==true)
{
return PLAYER2;
}
//30
if (redboard[2][1]==true && redboard[3][1]==true && redboard[4][1]==true && redboard[5][1]==true)
{
return PLAYER1;
}
if (blueboard[2][1]==true && blueboard[3][1]==true && blueboard[4][1]==true && blueboard[5][1]==true)
{
return PLAYER2;
}
//31
if (redboard[0][2]==true && redboard[1][2]==true && redboard[2][2]==true && redboard[3][2]==true)
{
return PLAYER1;
}
if (blueboard[0][2]==true && blueboard[1][2]==true && blueboard[2][2]==true && blueboard[3][2]==true)
{
return PLAYER2;
}
//32
if (redboard[1][2]==true && redboard[2][2]==true && redboard[3][2]==true && redboard[4][2]==true)
{
return PLAYER1;
}
if (blueboard[1][2]==true && blueboard[2][2]==true && blueboard[3][2]==true && blueboard[4][2]==true)
{
return PLAYER2;
}
//33
if (redboard[2][2]==true && redboard[3][2]==true && redboard[4][2]==true && redboard[5][2]==true)
{
return PLAYER1;
}
if (blueboard[2][2]==true && blueboard[3][2]==true && blueboard[4][2]==true && blueboard[5][2]==true)
{
return PLAYER2;
}
//34
if (redboard[0][3]==true && redboard[1][3]==true && redboard[2][3]==true && redboard[3][3]==true)
{
return PLAYER1;
}
if (blueboard[0][3]==true && blueboard[1][3]==true && blueboard[2][3]==true && blueboard[3][3]==true)
{
return PLAYER2;
}
//35
if (redboard[1][3]==true && redboard[2][3]==true && redboard[3][3]==true && redboard[4][3]==true)
{
return PLAYER1;
}
if (blueboard[1][3]==true && blueboard[2][3]==true && blueboard[3][3]==true && blueboard[4][3]==true)
{
return PLAYER2;
}
//36
if (redboard[2][3]==true && redboard[3][3]==true && redboard[4][3]==true && redboard[5][3]==true)
{
return PLAYER1;
}
if (blueboard[2][3]==true && blueboard[3][3]==true && blueboard[4][3]==true && blueboard[5][3]==true)
{
return PLAYER2;
}
//37
if (redboard[0][4]==true && redboard[1][4]==true && redboard[2][4]==true && redboard[3][4]==true)
{
return PLAYER1;
}
if (blueboard[0][4]==true && blueboard[1][4]==true && blueboard[2][4]==true && blueboard[3][4]==true)
{
return PLAYER2;
}
//38
if (redboard[1][4]==true && redboard[2][4]==true && redboard[3][4]==true && redboard[4][4]==true)
{
return PLAYER1;
}
if (blueboard[1][4]==true && blueboard[2][4]==true && blueboard[3][4]==true && blueboard[4][4]==true)
{
return PLAYER2;
}
//39
if (redboard[2][4]==true && redboard[3][4]==true && redboard[4][4]==true && redboard[3][5]==true)
{
return PLAYER1;
}
if (blueboard[2][4]==true && blueboard[3][4]==true && blueboard[4][4]==true && blueboard[3][5]==true)
{
return PLAYER2;
}
//40
if (redboard[0][5]==true && redboard[1][5]==true && redboard[2][5]==true && redboard[3][5]==true)
{
return PLAYER1;
}
if (blueboard[0][5]==true && blueboard[1][5]==true && blueboard[2][5]==true && blueboard[3][5]==true)
{
return PLAYER2;
}
//41
if (redboard[1][5]==true && redboard[2][5]==true && redboard[3][5]==true && redboard[4][5]==true)
{
return PLAYER1;
}
if (blueboard[1][5]==true && blueboard[2][5]==true && blueboard[3][5]==true && blueboard[4][5]==true)
{
return PLAYER2;
}
//42
if (redboard[2][5]==true && redboard[3][5]==true && redboard[4][5]==true && redboard[5][5]==true)
{
return PLAYER1;
}
if (blueboard[2][5]==true && blueboard[3][5]==true && blueboard[4][5]==true && blueboard[5][5]==true)
{
return PLAYER2;
}
//43
if (redboard[0][6]==true && redboard[1][6]==true && redboard[2][6]==true && redboard[3][6]==true)
{
return PLAYER1;
}
if (blueboard[0][6]==true && blueboard[1][6]==true && blueboard[2][6]==true && blueboard[3][6]==true)
{
return PLAYER2;
}
//44
if (redboard[1][6]==true && redboard[2][6]==true && redboard[3][6]==true && redboard[4][6]==true)
{
return PLAYER1;
}
if (blueboard[1][6]==true && blueboard[2][6]==true && blueboard[3][6]==true && blueboard[4][6]==true)
{
return PLAYER2;
}
//45
if (redboard[2][6]==true && redboard[3][6]==true && redboard[4][6]==true && redboard[5][6]==true)
{
return PLAYER1;
}
if (blueboard[2][6]==true && blueboard[3][6]==true && blueboard[4][6]==true && blueboard[5][6]==true)
{
return PLAYER2;
}
//diagonal bottomleft to top right
//46
if (redboard[3][0]==true && redboard[2][1]==true && redboard[1][2]==true && redboard[0][3]==true)
{
return PLAYER1;
}
if (blueboard[3][0]==true && blueboard[2][1]==true && blueboard[1][2]==true && blueboard[0][3]==true)
{
return PLAYER2;
}
//47
if (redboard[5][3]==true && redboard[4][4]==true && redboard[3][5]==true && redboard[2][6]==true)
{
return PLAYER1;
}
if (blueboard[5][3]==true && blueboard[4][4]==true && blueboard[3][5]==true && blueboard[2][6]==true)
{
return PLAYER2;
}
//48
if (redboard[4][0]==true && redboard[3][1]==true && redboard[2][2]==true && redboard[1][3]==true)
{
return PLAYER1;
}
if (blueboard[4][0]==true && blueboard[3][1]==true && blueboard[2][2]==true && blueboard[1][3]==true)
{
return PLAYER2;
}
//49
if (redboard[3][1]==true && redboard[2][2]==true && redboard[1][3]==true && redboard[0][4]==true)
{
return PLAYER1;
}
if (blueboard[3][1]==true && blueboard[2][2]==true && blueboard[1][3]==true && blueboard[0][4]==true)
{
return PLAYER2;
}
//50
if (redboard[5][2]==true && redboard[4][3]==true && redboard[3][4]==true && redboard[2][5]==true)
{
return PLAYER1;
}
if (blueboard[5][2]==true && blueboard[4][3]==true && blueboard[3][4]==true && blueboard[2][5]==true)
{
return PLAYER2;
}
//51
if (redboard[4][3]==true && redboard[3][4]==true && redboard[2][5]==true && redboard[1][6]==true)
{
return PLAYER1;
}
if (blueboard[4][3]==true && blueboard[3][4]==true && blueboard[2][5]==true && blueboard[1][6]==true)
{
return PLAYER2;
}
//52
if (redboard[5][1]==true && redboard[4][2]==true && redboard[3][3]==true && redboard[2][4]==true)
{
return PLAYER1;
}
if (blueboard[5][1]==true && blueboard[4][2]==true && blueboard[3][3]==true && blueboard[2][4]==true)
{
return PLAYER2;
}
//53
if (redboard[4][2]==true && redboard[3][3]==true && redboard[2][4]==true && redboard[1][5]==true)
{
return PLAYER1;
}
if (blueboard[4][2]==true && blueboard[3][3]==true && blueboard[2][4]==true && blueboard[1][5]==true)
{
return PLAYER2;
}
//54
if (redboard[3][3]==true && redboard[2][4]==true && redboard[1][5]==true && redboard[0][6]==true)
{
return PLAYER1;
}
if (blueboard[3][3]==true && blueboard[2][4]==true && blueboard[1][5]==true && blueboard[0][6]==true)
{
return PLAYER2;
}
//55
if (redboard[5][0]==true && redboard[4][1]==true && redboard[3][2]==true && redboard[2][3]==true)
{
return PLAYER1;
}
if (blueboard[5][0]==true && blueboard[4][1]==true && blueboard[3][2]==true && blueboard[2][3]==true)
{
return PLAYER2;
}
//56
if (redboard[4][1]==true && redboard[3][2]==true && redboard[2][3]==true && redboard[1][4]==true)
{
return PLAYER1;
}
if (blueboard[4][1]==true && blueboard[3][2]==true && blueboard[2][3]==true && blueboard[1][4]==true)
{
return PLAYER2;
}
//57
if (redboard[3][2]==true && redboard[2][3]==true && redboard[1][4]==true && redboard[0][5]==true)
{
return PLAYER1;
}
if (blueboard[3][2]==true && blueboard[2][3]==true && blueboard[1][4]==true && blueboard[0][5]==true)
{
return PLAYER2;
}
//diagonal top left to bottom right
//58
if (redboard[2][0]==true && redboard[3][1]==true && redboard[4][2]==true && redboard[5][3]==true)
{
return PLAYER1;
}
if (blueboard[2][0]==true && blueboard[3][1]==true && blueboard[4][2]==true && blueboard[5][3]==true)
{
return PLAYER2;
}
//59
if (redboard[0][3]==true && redboard[1][4]==true && redboard[2][5]==true && redboard[3][6]==true)
{
return PLAYER1;
}
if (blueboard[0][3]==true && blueboard[1][4]==true && blueboard[2][5]==true && blueboard[3][6]==true)
{
return PLAYER2;
}
//60
if (redboard[1][0]==true && redboard[2][1]==true && redboard[3][2]==true && redboard[4][3]==true)
{
return PLAYER1;
}
if (blueboard[1][0]==true && blueboard[2][1]==true && blueboard[3][2]==true && blueboard[4][3]==true)
{
return PLAYER2;
}
//61
if (redboard[2][1]==true && redboard[3][2]==true && redboard[4][3]==true && redboard[5][4]==true)
{
return PLAYER1;
}
if (blueboard[2][1]==true && blueboard[3][2]==true && blueboard[4][3]==true && blueboard[5][4]==true)
{
return PLAYER2;
}
//62
if (redboard[0][2]==true && redboard[1][3]==true && redboard[2][4]==true && redboard[3][5]==true)
{
return PLAYER1;
}
if (blueboard[0][2]==true && blueboard[1][3]==true && blueboard[2][4]==true && blueboard[3][5]==true)
{
return PLAYER2;
}
//63
if (redboard[1][3]==true && redboard[2][4]==true && redboard[3][5]==true && redboard[4][6]==true)
{
return PLAYER1;
}
if (blueboard[1][3]==true && blueboard[2][4]==true && blueboard[3][5]==true && blueboard[4][6]==true)
{
return PLAYER2;
}
//64
if (redboard[0][1]==true && redboard[1][2]==true && redboard[2][3]==true && redboard[3][4]==true)
{
return PLAYER1;
}
if (blueboard[0][1]==true && blueboard[1][2]==true && blueboard[2][3]==true && blueboard[3][4]==true)
{
return PLAYER2;
}
//65
if (redboard[1][2]==true && redboard[2][3]==true && redboard[3][4]==true && redboard[4][5]==true)
{
return PLAYER1;
}
if (blueboard[1][2]==true && blueboard[2][3]==true && blueboard[3][4]==true && blueboard[4][5]==true)
{
return PLAYER2;
}
//66
if (redboard[2][3]==true && redboard[3][4]==true && redboard[4][5]==true && redboard[5][6]==true)
{
return PLAYER1;
}
if (blueboard[2][3]==true && blueboard[3][4]==true && blueboard[4][5]==true && blueboard[5][6]==true)
{
return PLAYER2;
}
//67
if (redboard[0][0]==true && redboard[1][1]==true && redboard[2][2]==true && redboard[3][3]==true)
{
return PLAYER1;
}
if (blueboard[0][0]==true && blueboard[1][1]==true && blueboard[2][2]==true && blueboard[3][3]==true)
{
return PLAYER2;
}
//68
if (redboard[1][1]==true && redboard[2][2]==true && redboard[3][3]==true && redboard[4][4]==true)
{
return PLAYER1;
}
if (blueboard[1][1]==true && blueboard[2][2]==true && blueboard[3][3]==true && blueboard[4][4]==true)
{
return PLAYER2;
}
//69
if (redboard[2][2]==true && redboard[3][3]==true && redboard[4][4]==true && redboard[5][5]==true)
{
return PLAYER1;
}
if (blueboard[2][2]==true && blueboard[3][3]==true && blueboard[4][4]==true && blueboard[5][5]==true)
{
return PLAYER2;
}
return 0;
//yes this function was a pain int the ass to make
}

void winningboard(char board[][7], bool blueboolboard [][7], bool redboolboard[][7])
{
char letter;
cout<<endl<<endl<<endl<<endl;
for (int x=0; x<6; x++)
{
cout<<setw(5);
for (int y=0; y<7; y++)
{
if (blueboolboard[x][y])
{
setcolor(BLACK, LIGHT_BLUE);
cout<<board[x][y]<<' ';
setcolor(BLACK, WHITE);
}
else if (redboolboard[x][y])
{
setcolor(BLACK, RED);
cout<<board[x][y]<<' ';
setcolor(BLACK, WHITE);
}
else
{
setcolor(BLACK, YELLOW);
cout<<board[x][y]<<' ';
setcolor(BLACK, WHITE);
}
}
cout<<endl;
}
setcolor(BLACK, BRIGHT_BLUE);
letter=219;
cout<<" "<<letter<<" "<<letter<<endl;
letter=30;
cout<<endl;
setcolor(BLACK, WHITE);
}//1241 Lines

----------------------------------------------------
C-de Aynı Sayıdan Kaç Kere Girildiğini Bulma

#include <stdio.h>
#include <conio.h>

#define max 32000

main()
{
      int a[5],b[max],i,j;
     
      for (j=1;j<max;j++)
      {
          b[j]=0;
      }
     
      for (i=1;i<11;i++)
      {
          system("CLS");
          printf ("n %d. Sayiyi Giriniz: ",i);
          scanf ("%d",&a[i]);
         
          b[a[i]] += 1;
      }
     
      printf ("n");
      system("CLS");
     
      for (j=1;j<max;j++)
      {
          if (b[j] != 0 )
          {
                   printf ("n %d Sayisini %d kez girdiniz.n",j,b[j]);
          }
      }
         
      getch();
}
------------------------------------------------------------------------------------
Bir Sayının Asal Olup Olmadığına Bakmak:

#include <stdio.h>

     int main()
{
     int a, b, c = 0;

        printf (" Bir sayi giriniz: ");
        scanf  ("%d", &a);
             printf ("n");
             for (b = 2; b < a; b ++)
             {
          // Kullanıcıdan alınan sayı 2'den başlanarak, kendisine kadar
          // olan tüm tamsayılara sırayla bölünüyor. Eğer tam olarak
          // bölünüyorsa c'nin değeri bir artırılıyor.
               if (a % b == 0) c ++;
        }
     
        // c'nin başlangıç değeri 0 idi. Eğer a'nın tek bir tane bile tam
        // böleni olsaydı, c'nin değeri 0 kalmazdı. c'nin değerinin 0
             // kalması, kullanıcının girdiği sayının 2'den itibaren hiçbir
        // tamsayıya tam olarak bölünemediği anlamını taşır. Yani girilen
        // sayı asaldır.
             printf (" %sn", (c == 0) ? "Sayi asaldir." : "Sayi asal degildir.");
             return 0;
}
----------------------------------------------------------------------------------------------------------------
Dizi İstatistiği:

#include "stdio.h"

int main(){

  signed int n;
  
  printf("dizinin boyutunu giriniz : ");
  scanf("%d",&n);
  
  printf("nnElemanlarn----------------------n");

  int i,d[n];
  
  // bilgi girisi
  for( i=0; i<n; i++ ){

    printf("%d.eleman : ",i+1);
    scanf("%d",&d[i]);

  }
  
  // en buyuk en kucuk elemanlari
  int enbuyuk, enkucuk;
  enbuyuk = d[0];
  enkucuk = d[0];
  for( i=1; i<n; i++ ){
  
    if( d[i] > enbuyuk ){
    
      enbuyuk = d[i];
    
    }

  }
  for( i=1; i<n; i++ ){
  
    if( d[i] < enkucuk ){
    
      enkucuk = d[i];
    
    }

  }
  
  
  // her elemanin kac tane gectigini bulalim.
  int e[10000];
  
  for( i=0; i<n; i++ ){
    
    e[d[i]]++;
    
  }
  
  
  // ekrana basalim
  int j;
  for( j=enkucuk; j<=enbuyuk; j++ ){
  
    if( e[j] > 0 ){
    
      printf("n"%d" elemanindan %d tane var.",j,e[j]);
    
    }
  
  }

}

Yazılım&Programlama  
   
Reklam  
   
 
   
 
   
 
   
 
   
Bugün 1 ziyaretçi (33 klik) kişi burdaydı!
=> Sen de ücretsiz bir internet sitesi kurmak ister misin? O zaman burayı tıkla! <=