<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1771903383381188295</id><updated>2024-12-18T19:16:52.612-08:00</updated><category term="Java"/><category term="Game"/><category term="Cpp"/><category term="Game Progamming"/><category term="Snake"/><category term="Codes"/><category term="algorithm"/><category term="engerek"/><category term="Array"/><category term="BackTrack 5"/><category term="Binary Tree"/><category term="Display Mode"/><category term="FullScreen"/><category term="Image"/><category term="Stack"/><category term="actionlistener"/><category term="fclose"/><category term="fopen"/><category term="fseek"/><category term="keylistener"/><category term="mouse motion"/><category term="mouselistener"/><category term="mousemotionlistener"/><category term="on background dragging"/><category term="programming"/><category term="recursive"/><category term="sorting"/><category term="2 Dimensional"/><category term="8 bit"/><category term="8bit"/><category term="Allocation"/><category term="Arrays"/><category term="BFS"/><category term="Bağlantılı liste"/><category term="Blogspot"/><category term="Breath First Search"/><category term="C codes"/><category term="C++"/><category term="Calc"/><category term="Cmd"/><category term="Commands"/><category term="Core"/><category term="Core class"/><category term="DFS"/><category term="DecimalFormat"/><category term="Depth First Search"/><category term="Example"/><category term="Four of a Kind"/><category term="Getline"/><category term="Graphics"/><category term="Graphics Card"/><category term="GraphicsCard"/><category term="Highlighter"/><category term="Inheritance"/><category term="JFrame"/><category term="Javascript"/><category term="Linked List"/><category term="Linux"/><category term="Magic"/><category term="Magic Square"/><category term="Matrix"/><category term="Maze"/><category term="Memory"/><category term="Midterm"/><category term="Mode"/><category term="Ms-Dos"/><category term="NQueen"/><category term="Object"/><category term="One Pair"/><category term="Oriented"/><category term="Pointer"/><category term="Poker"/><category term="Polymorphism"/><category term="Queue"/><category term="Samples"/><category term="Signal"/><category term="Signals"/><category term="Signals and Systems"/><category term="Square"/><category term="Syntax"/><category term="System"/><category term="Systems"/><category term="Thread"/><category term="Threeof a kind"/><category term="Time.h"/><category term="Tree"/><category term="Two Pair"/><category term="UNetbootin"/><category term="Veri yapıları"/><category term="Windows"/><category term="adapter"/><category term="background"/><category term="c"/><category term="calculator"/><category term="chess"/><category term="class"/><category term="clock"/><category term="container"/><category term="counter"/><category term="drag"/><category term="dragged"/><category term="dragging"/><category term="eight"/><category term="feof"/><category term="file"/><category term="file process"/><category term="fprintf"/><category term="fread"/><category term="fscanf"/><category term="fwrite"/><category term="image processing"/><category term="insert"/><category term="insertion"/><category term="intalling"/><category term="javada mouse"/><category term="kullanamak"/><category term="lastmove"/><category term="logic"/><category term="merge"/><category term="mergesorting"/><category term="mmlogic"/><category term="mouse"/><category term="movedelay"/><category term="n queen"/><category term="pingpong"/><category term="queen"/><category term="recursivesort"/><category term="rekürsif"/><category term="ripple"/><category term="ripple counter"/><category term="satranc"/><category term="satranç"/><category term="screen"/><category term="sekiz"/><category term="sort"/><category term="string"/><category term="variables"/><category term="vezir"/><category term="vize"/><title type='text'>Yes, Commander!</title><subtitle type='html'>All i know</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>44</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-1386850672242266051</id><published>2019-05-05T07:51:00.000-07:00</published><updated>2019-05-05T07:51:20.587-07:00</updated><title type='text'>Redbox Game Studios - Solitaire #1</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPP0USKN5doKN78e7-mTTbtfJ0wajhg_etp8d9_g7jT-OE-tyhFVpoSP2sc9r8-y3kLtvVynGYLYdjQDF_Xy7TIoc_eeZ3wASpksyjytWnp1yA5it5bbyeUyKfTZgL_mwGEj71jEVREL1B/s1600/SlidingBox-Icons-512.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;512&quot; data-original-width=&quot;512&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPP0USKN5doKN78e7-mTTbtfJ0wajhg_etp8d9_g7jT-OE-tyhFVpoSP2sc9r8-y3kLtvVynGYLYdjQDF_Xy7TIoc_eeZ3wASpksyjytWnp1yA5it5bbyeUyKfTZgL_mwGEj71jEVREL1B/s320/SlidingBox-Icons-512.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h2&gt;
Ultimate Classic Solitaire card game&amp;nbsp;&lt;/h2&gt;
New experience and joy

Solitaire, also known as Klondike, Solitaire or Patience, is the most popular single player card game in the world. If you like classic Solitaire, you&#39;re going to love this crisp and clear solitaire game!&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
Game Features:&amp;nbsp;&lt;/h4&gt;
•  FREE&lt;br /&gt;
•  Beautiful graphics&lt;br /&gt;
•  Klondike Solitaire Draw 1 card&lt;br /&gt;
•  Klondike Solitaire Draw 3 cards&lt;br /&gt;
•  Option for all winning deals&lt;br /&gt;
•  Auto complete&lt;br /&gt;
•  Unlimited free undos&lt;br /&gt;
•  Unlimited free hints&lt;br /&gt;
•  Intelligent hints and auto hints&lt;br /&gt;
•  Daily Challenge&lt;br /&gt;
•  Timed mode and Untimed mode&lt;br /&gt;
•  Vegas scoring and Vegas cumulative scoring&lt;br /&gt;
•  Customizable card faces, card backs and backgrounds&lt;br /&gt;
•  High scores and personal statistics&lt;br /&gt;
•  Sound that can be turned on/off&lt;br /&gt;
•  Tablet and phone support&lt;br /&gt;
•  Multiple windows and tasks support&lt;br /&gt;
•  No network required&lt;br /&gt;
•  And so much more!&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://itunes.apple.com/us/app/solitaire-1/id1457614475?mt=8&amp;amp;ign-mpt=uo%3D8&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;80&quot; data-original-width=&quot;260&quot; height=&quot;61&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheBMvAMD-HbOi-52SWZ9u24evRKE08qCf8n7i_kctYQcMuJuctn6D9wdmQosEf_KhMtTLOfYhhO5WKgTEHfPa345jARbwFFAEz2gr831UMnJfPDzUSw1aXOK0YnMUrqtQe9iuVJUFC8GwQ/s200/apple%25402x.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp;&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.redbox.solitairekings&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;80&quot; data-original-width=&quot;260&quot; height=&quot;61&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggAElaFg0v0FrXwRjQy-B2gTv08-YI9FIzoyPvOEcN4njxBkpVLLTKRpZXPMy7CY-odwFe_n7xQr_gyGz8wGrFI1y94QbSz82ybf4F0Lk-I_OKXJOham5CN3SxGiUIB_w47f6kF2cOQrcM/s200/google%25402x.png&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Play the #1 FREE SOLITAIRE card game on &lt;a href=&quot;https://play.google.com/store/apps/details?id=com.redbox.solitairekings&quot; target=&quot;_blank&quot;&gt;Android Play Store&lt;/a&gt; and &lt;a href=&quot;https://itunes.apple.com/us/app/solitaire-1/id1457614475?mt=8&amp;amp;ign-mpt=uo%3D8&quot; target=&quot;_blank&quot;&gt;AppStore&lt;/a&gt; now and see for yourself why so many others love this game!&lt;br /&gt;
Facebook : &lt;a href=&quot;https://www.facebook.com/RedboXGameStudios/&quot;&gt;https://www.facebook.com/RedboXGameStudios/&lt;/a&gt;&lt;br /&gt;
Twitter : &lt;a href=&quot;https://twitter.com/studio_redbox&quot;&gt;https://twitter.com/studio_redbox&lt;/a&gt;&lt;br /&gt;
Instagram : &lt;a href=&quot;https://www.instagram.com/redboxgamestudios/&quot;&gt;https://www.instagram.com/redboxgamestudios/&lt;/a&gt;&lt;br /&gt;
Pinterest : &lt;a href=&quot;https://www.pinterest.com/redboxgamestudios/&quot;&gt;https://www.pinterest.com/redboxgamestudios/&lt;/a&gt;&lt;br /&gt;
Youtube : &lt;a href=&quot;https://www.youtube.com/channel/UCucroP4IAXm5Ks6gKta2L7g&quot;&gt;https://www.youtube.com/channel/UCucroP4IAXm5Ks6gKta2L7g&lt;/a&gt;&lt;br /&gt;
Dailymotion : &lt;a href=&quot;https://www.dailymotion.com/redbox-game-studios&quot;&gt;https://www.dailymotion.com/redbox-game-studios&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/1386850672242266051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2019/05/redbox-game-studios.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1386850672242266051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1386850672242266051'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2019/05/redbox-game-studios.html' title='Redbox Game Studios - Solitaire #1'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPP0USKN5doKN78e7-mTTbtfJ0wajhg_etp8d9_g7jT-OE-tyhFVpoSP2sc9r8-y3kLtvVynGYLYdjQDF_Xy7TIoc_eeZ3wASpksyjytWnp1yA5it5bbyeUyKfTZgL_mwGEj71jEVREL1B/s72-c/SlidingBox-Icons-512.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-1586360924589039116</id><published>2012-10-15T13:38:00.000-07:00</published><updated>2012-10-15T13:38:18.810-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="algorithm"/><category scheme="http://www.blogger.com/atom/ns#" term="chess"/><category scheme="http://www.blogger.com/atom/ns#" term="eight"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="n queen"/><category scheme="http://www.blogger.com/atom/ns#" term="NQueen"/><category scheme="http://www.blogger.com/atom/ns#" term="queen"/><category scheme="http://www.blogger.com/atom/ns#" term="recursive"/><category scheme="http://www.blogger.com/atom/ns#" term="rekürsif"/><category scheme="http://www.blogger.com/atom/ns#" term="satranc"/><category scheme="http://www.blogger.com/atom/ns#" term="satranç"/><category scheme="http://www.blogger.com/atom/ns#" term="sekiz"/><category scheme="http://www.blogger.com/atom/ns#" term="vezir"/><title type='text'>N Queen Algorithm</title><content type='html'>&lt;pre class=&quot;brush :java&quot;&gt;
package eight.queen.algorithm;



public class Queen {
 
 private int N = 8; 
 private int chess[][];
 
 
 public Queen(){
  chess = new int[N][N];
  System.out.println(N+&quot; sizes chess table contain &quot;+NQueen(0)+&quot;\n&quot;);
 }
 
 public int NQueen(int currentRow){
  
  if(currentRow==N)
   return 1;
  int totalQueenSetting = 0;
  for(int i = 0;i&amp;ltN;i++){
   if(chess[currentRow][i]==0){ 
    chess[currentRow][i] = 1+currentRow;
    setConsumedSquares(currentRow,i);
    
    totalQueenSetting += NQueen(currentRow+1);
    for(int k = 0; k&amp;ltN;k++)
     for(int j = 0;j&amp;ltN;j++)
      if(chess[k][j]==8){
       print();
       System.out.println(&quot;\t&quot;);
       break;
      }
    chess[currentRow][i] = 0;
    recover(currentRow);
   }
  }
  return totalQueenSetting;
 }
 public void setConsumedSquares(int row,int i){
  for(int j = row+1;j&amp;ltN;j++){
   if(chess[j][i]==0)
   chess[j][i] = (1+row);
   if(i-(j-row)&gt;=0 &amp;&amp; chess[j][i-(j-row)] == 0)
    chess[j][i-(j-row)] = (1+row);
   if(i+(j-row) &amp;lt N &amp;&amp; chess[j][i+(j-row)] == 0)
    chess[j][i+(j-row)] = (1+row);
  }
   
 }
 public void recover(int row){
  for(int i = row;i&amp;ltN;i++)
   for(int j = 0;j&amp;ltN;j++)
    if(chess[i][j]==(1+row))
     chess[i][j] = 0;
 }
 public void print(){
  for(int i = 0; i&amp;ltN;i++)
   for(int j = 0;j&amp;ltN;j++){
    System.out.print(chess[i][j]+&quot; &quot;);
    if(j == N-1)
     System.out.println(&quot;\t&quot;);
   }
 }
 public static void main(String[] args){
  Queen test = new Queen();
  
 }
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/1586360924589039116/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/10/n-queen-algorithm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1586360924589039116'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1586360924589039116'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/10/n-queen-algorithm.html' title='N Queen Algorithm'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-1244827234777723977</id><published>2012-10-15T13:35:00.001-07:00</published><updated>2012-10-15T13:35:31.884-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="algorithm"/><category scheme="http://www.blogger.com/atom/ns#" term="insert"/><category scheme="http://www.blogger.com/atom/ns#" term="insertion"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="sort"/><category scheme="http://www.blogger.com/atom/ns#" term="sorting"/><title type='text'>insertion sorting</title><content type='html'>&lt;pre class=&quot;brush : java&quot;&gt;


public class insertionSorting {

 /**
  * @param args
  */
 
 
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  insertionSorting test = new insertionSorting();
 }
 
 public insertionSorting(){
  int array[] = {2,5,1,9,12,3,6,7,11,11,11,8,21,17,45,46,33,22};
  sorting(array);
  print(array);
 }
 
 public void sorting(int[] buffer){
  int key,i;
  for(int j = 1;j&amp;ltbuffer.length;j++)
  {
   key = buffer[j];
   i = j-1;
   while((i&gt;=0) &amp;&amp; buffer[i] &gt; key){
    buffer[i+1] = buffer[i];
    i = i-1;
   }
   buffer[i+1] = key;
  }
 }
 public void print(int[] buffer){
  for(int i = 0;i&amp;ltbuffer.length;i++)
   System.out.print(buffer[i]+&quot;, &quot;);
 }
 
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/1244827234777723977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/10/insertion-sorting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1244827234777723977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1244827234777723977'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/10/insertion-sorting.html' title='insertion sorting'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-7411240861037418013</id><published>2012-10-15T13:33:00.002-07:00</published><updated>2012-10-15T13:33:56.964-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="algorithm"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="merge"/><category scheme="http://www.blogger.com/atom/ns#" term="mergesorting"/><category scheme="http://www.blogger.com/atom/ns#" term="recursive"/><category scheme="http://www.blogger.com/atom/ns#" term="recursivesort"/><category scheme="http://www.blogger.com/atom/ns#" term="sorting"/><title type='text'>Merge Sorting</title><content type='html'>&lt;pre class=&quot;brush: java&quot;&gt;


public class mergeSort {

 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  mergeSort test = new mergeSort();
 }
 private int[] array;
 private int N;
 public mergeSort(){
  N = 10;
  array = new int[N];
  for(int i=0;i&amp;ltarray.length;i++)
   array[i] = (int)(Math.random()*10)+1;
  print(array);
  sort(array,0,N-1);
  print(array);
 }
 public void print(int []array){
  for(int i = 0;i&amp;ltarray.length;i++)
   System.out.print(array[i]+&quot;, &quot;);
  System.out.println(&quot;&quot;);
 }
 public void sort(int []array,int p,int r){
  if(r-p&gt;=1)
  {
   int q = (int)(Math.floor((double)((p+r)/2)));
   sort(array,p,q);
   sort(array,q+1,r);
   merge(array,p,q,r);
  } 
   
 }
 public void merge(int []array,int p,int q,int r){
  int n1 = q-p+1;
  int n2 = r-q;
  int left[] = new int[n1+1];
  int right[] = new int[n2+1];
  for(int i = 0;i&amp;ltleft.length-1;i++)
   left[i] = array[p+i];
  for(int i=0;i&amp;ltright.length-1;i++)
   right[i] = array[q+i+1];
  left[n1] = 11;
  right[n2] = 11;
  int i = 0;
  int j = 0;
  for(int k = p;k&amp;lt=r;k++){
   if(left[i]&lt;=right[j]){
    array[k] = left[i];
    i++;
   }else{
    array[k] = right[j];
    j++;
   }
  }
  
 }
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/7411240861037418013/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/10/merge-sorting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/7411240861037418013'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/7411240861037418013'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/10/merge-sorting.html' title='Merge Sorting'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-2766849211256167360</id><published>2012-08-11T07:57:00.001-07:00</published><updated>2012-08-11T07:59:08.001-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="actionlistener"/><category scheme="http://www.blogger.com/atom/ns#" term="Calc"/><category scheme="http://www.blogger.com/atom/ns#" term="calculator"/><category scheme="http://www.blogger.com/atom/ns#" term="class"/><category scheme="http://www.blogger.com/atom/ns#" term="container"/><category scheme="http://www.blogger.com/atom/ns#" term="DecimalFormat"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>ActionListener Example</title><content type='html'>&lt;pre class=&quot;brush : java&quot;&gt;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.text.DecimalFormat;
import java.util.ArrayList;


public class makine extends JApplet{

 
 private int counter = 0;
 
 
 private ArrayList&amp;ltString&gt; liste;
 private String[] yazi;
 private JButton one,two,three,four,five,
 six,seven,eight,nine,zero,
 arti,eksi,bolu,carpi,CE,esit;
 
 
 
 private JTextField ekran;
 private JLabel yazar;
 private DecimalFormat dec;
 
 public String ToString(Double d)
 {
  return d.toString();
 }
 //@override
 public void init()
 { 
  yazi = new String[11];
  liste = new ArrayList&amp;ltString&gt;();
  for(int i = 0;i&amp;lt11;i++){
   yazi[i] = &quot;&quot;;
  }
  ActionHandler handler = new ActionHandler();
  Container container = this.getContentPane();
  container.setLayout(new FlowLayout(1,8,2));
  
  
  
  dec = new DecimalFormat(&quot;0.000&quot;);
  one = new JButton();
  one.setText(&quot;1&quot;);
  one.setSize(20, 20);
  one.setLocation(40, 40);
  container.add(one);
  one.addActionListener(handler);
  
  
  two = new JButton();
  two.setText(&quot;2&quot;);
  two.setSize(20, 20);
  two.setLocation(40, 40);
  container.add(two);
  two.addActionListener(handler);
  
  three = new JButton();
  three.setText(&quot;3&quot;);
  three.setSize(20, 20);
  three.setLocation(70, 40);
  container.add(three);
  three.addActionListener(handler);
  
  arti = new JButton();
  arti.setText(&quot;+&quot;);
  arti.setSize(20, 20);
  arti.setLocation(100, 40);
  container.add(arti);
  arti.addActionListener(handler);
  
  four = new JButton();
  four.setText(&quot;4&quot;);
  four.setSize(20, 20);
  four.setLocation(10, 70);
  container.add(four);
  four.addActionListener(handler);
  
  five = new JButton();
  five.setText(&quot;5&quot;);
  five.setSize(20, 20);
  five.setLocation(40, 70);
  container.add(five);
  five.addActionListener(handler);
  
  six = new JButton();
  six.setText(&quot;6&quot;);
  six.setSize(20, 20);
  six.setLocation(70, 70);
  container.add(six);
  six.addActionListener(handler);
  
  eksi = new JButton();
  eksi.setText(&quot;-&quot;);
  eksi.setSize(20, 20);
  eksi.setLocation(10, 70);
  container.add(eksi);
  eksi.addActionListener(handler);
  
  seven = new JButton();
  seven.setText(&quot;7&quot;);
  seven.setSize(20, 20);
  seven.setLocation(10, 100);
  container.add(seven);
  seven.addActionListener(handler);
  

  
  
  eight = new JButton();
  eight.setText(&quot;8&quot;);
  eight.setSize(20, 20);
  eight.setLocation(40, 100);
  container.add(eight);
  eight.addActionListener(handler);
  
  nine = new JButton();
  nine.setText(&quot;9&quot;);
  nine.setSize(20, 20);
  nine.setLocation(70, 100);
  container.add(nine);
  nine.addActionListener(handler);
  
  carpi = new JButton();
  carpi.setText(&quot;x&quot;);
  carpi.setSize(20, 20);
  carpi.setLocation(100, 130);
  container.add(carpi);
  carpi.addActionListener(handler);
  
  CE = new JButton();
  CE.setText(&quot;CE&quot;);
  CE.setSize(20, 20);
  CE.setLocation(10, 100);
  container.add(CE);
  CE.addActionListener(handler);
  
  zero = new JButton();
  zero.setText(&quot;0&quot;);
  zero.setSize(20, 20);
  zero.setLocation(40, 130);
  container.add(zero);
  zero.addActionListener(handler);
  
  
  
  
  bolu = new JButton();
  bolu.setText(&quot;/&quot;);
  bolu.setSize(20, 20);
  bolu.setLocation(100, 100);
  container.add(bolu);
  bolu.addActionListener(handler);
  
  
  
  esit = new JButton();
  esit.setText(&quot;=&quot;);
  esit.setSize(20, 20);
  esit.setLocation(70, 100);
  container.add(esit);
  esit.addActionListener(handler);
  
  ekran = new JTextField(15);
  ekran.setText(&quot; &quot;);
  ekran.setEditable(false);
  ekran.setDisabledTextColor(Color.BLUE );
  ekran.setVisible(true);
  ekran.setAlignmentY(JTextField.RIGHT_ALIGNMENT);
  ekran.setHorizontalAlignment(JTextField.RIGHT);
  ekran.setLocation(10,10);
  container.add(ekran);
  ekran.addActionListener(handler);
  
  yazar = new JLabel(&quot;Tested and Programmed by BY&quot;);
  container.add(yazar);
  
 }
 //inner class
 private class ActionHandler implements ActionListener
 {
  public void actionPerformed(ActionEvent event)
  {
   if(event.getSource() == one){
    if(counter&amp;lt11){
     yazi[counter]+=&quot;1&quot;;
     ekran.setText(yazi[counter]);
    }else ;
   }if(event.getSource() == two){
    if(counter&amp;lt11){
     yazi[counter]+=&quot;2&quot;;
     ekran.setText(yazi[counter]);
    }else ;
   }if(event.getSource() == three){
    if(counter&amp;lt11){
     yazi[counter]+=&quot;3&quot;;
     ekran.setText(yazi[counter]);
    }else;
   }if(event.getSource() == four){
    if(counter&amp;lt11){
     yazi[counter]+= &quot;4&quot;;
     ekran.setText(yazi[counter]);
    }else;
   }if(event.getSource() == five){
    if(counter&amp;lt11){
     yazi[counter] += &quot;5&quot;;
     ekran.setText(yazi[counter]);
    }else;
   }if(event.getSource() == six){
    if(counter&amp;lt11){
     yazi[counter] += &quot;6&quot;;
     ekran.setText(yazi[counter]);
    }else;
   }if(event.getSource() == seven){
    if(counter&amp;lt11){
     yazi[counter] += &quot;7&quot;;
     ekran.setText(yazi[counter]);
    }else;
   }if(event.getSource() == eight){
    if(counter&amp;lt11){
     yazi[counter] += &quot;8&quot;;
     ekran.setText(yazi[counter]);
    }else;
   }if(event.getSource() == nine){
    if(counter&amp;lt11){
     yazi[counter] += &quot;9&quot;;
     ekran.setText(yazi[counter]);
    }else;
   }if(event.getSource() == zero){
    if(counter&amp;lt11){
     yazi[counter] += &quot;0&quot;;
     ekran.setText(yazi[counter]);
    }else;
   }if(event.getSource() == arti){
    try{
    if(Double.parseDouble(yazi[counter])&gt;=0){
    counter++;
    yazi[counter] = &quot;+&quot;;
    counter++;
    }else;
    }catch(Exception e){
     ekran.setText(&quot;Syntax Error&quot;);
    }
   }if(event.getSource() == eksi){
    try{
    if(Double.parseDouble(yazi[counter])&gt;=0){
    counter++;
    yazi[counter] = &quot;-&quot;;
    counter++;
    }else;
    }catch(Exception e){
     ekran.setText(&quot;Syntax Error&quot;);
    }
   }if(event.getSource() == bolu){
    try{
    if(Double.parseDouble(yazi[counter])&gt;=0){
    counter++;
    yazi[counter] = &quot;/&quot;;
    counter++;
    }else;
    }catch(Exception e){
     ekran.setText(&quot;Syntax Error&quot;);
    }
   }if(event.getSource() == carpi){
    try{
    if(Double.parseDouble(yazi[counter])&gt;=0){
    counter++;
    yazi[counter] = &quot;*&quot;;
    counter++;
    }
    }catch(Exception e){
     ekran.setText(&quot;Syntax Error&quot;);
    }
   }if(event.getSource() == CE){
    for(int i = 0;i&amp;lt11;i++)
     yazi[i] = &quot;&quot;;
     ekran.setText(&quot;&quot;);
     counter = 0;
   }if(event.getSource() == esit){
    //try{
    for(int i = 0;i&amp;lt11;i++){
     liste.add(i,yazi[i]);
    }
    for(int i = 0;i&amp;lt11;i++){
     try{
     if(yazi[i]==&quot;/&quot;){
       
     yazi[i] = ToString(Double.parseDouble(yazi[i-1])/Double.parseDouble(yazi[i+1]));
       yazi[i-1] = yazi[i];
       yazi[i+1] = yazi[i];
       liste.remove(0);
       liste.add(0,yazi[i]);
      }
     }catch(Exception e){
      ekran.setText(&quot;Syntax Error&quot;);
      counter = 0;
     }
    }
    for(int i = 0;i&lt;11;i++){
     try{ 
     if(yazi[i]==&quot;*&quot;){
           yazi[i] = ToString(Double.parseDouble(yazi[i-1])*Double.parseDouble(yazi[i+1]));
       yazi[i-1] = yazi[i];
       yazi[i+1] = yazi[i];
       liste.remove(0);
       liste.add(0,yazi[i]);
       
      }
     }
     catch(Exception e){
      ekran.setText(&quot;Syntax Error&quot;);
      counter = 0;
     }
    }
    for(int i = 0;i&lt;11;i++){
     try{
     if(yazi[i]==&quot;+&quot;){
                         yazi[i] = ToString(Double.parseDouble(yazi[i-1])+Double.parseDouble(yazi[i+1]));
       yazi[i-1] = yazi[i];
       yazi[i+1] = yazi[i];
       liste.remove(0);
       liste.add(0,yazi[i]);
      } 
     }
     catch(Exception e){
      ekran.setText(&quot;Syntax Error&quot;);
      counter = 0;
     }
    }
    for(int i = 0;i&amp;lt11;i++){
     try{
     if(yazi[i]==&quot;-&quot;){
        
    yazi[i] = ToString(Double.parseDouble(yazi[i-1])-Double.parseDouble(yazi[i+1]));
       yazi[i-1] = yazi[i];
       yazi[i+1] = yazi[i];
       liste.remove(0);
       liste.add(0,yazi[i]);
      }
     }
     catch(Exception e){
      ekran.setText(&quot;Syntax Error&quot;);
      counter = 0;
     } 
    } 
     if(liste.isEmpty()){
      ekran.setText(&quot;Syntax Error&quot;);
      counter = 0;}
     else{
         if(liste.get(0)!=&quot;&quot;)
                              ekran.setText(liste.get(0).toString());
     }
     counter = 0;
     for(int i = 0;i&amp;lt11;i++)
      yazi[i] = &quot;&quot;;
     if(!liste.isEmpty())
      liste.clear();
      
    /*}catch(Exception e){
     ekran.setText(&quot;Syntax Error&quot;);
    }*/
   }
   
  }
 } 
}
&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBJW_TgCzUJzBVcnptd2qill_o1jxVXrkSykhzG6JQuLxHrvUrirTVownut-2_GZLQLv2iNt9jfUJDyplaIaib2rHiCJa3APKla9QKk88OgSoHrBrTBGYgV33Cs6xZRle_fYegph-f66aQ/s1600/hesap.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBJW_TgCzUJzBVcnptd2qill_o1jxVXrkSykhzG6JQuLxHrvUrirTVownut-2_GZLQLv2iNt9jfUJDyplaIaib2rHiCJa3APKla9QKk88OgSoHrBrTBGYgV33Cs6xZRle_fYegph-f66aQ/s400/hesap.png&quot; width=&quot;398&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/2766849211256167360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/08/actionlistener-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/2766849211256167360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/2766849211256167360'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/08/actionlistener-example.html' title='ActionListener Example'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBJW_TgCzUJzBVcnptd2qill_o1jxVXrkSykhzG6JQuLxHrvUrirTVownut-2_GZLQLv2iNt9jfUJDyplaIaib2rHiCJa3APKla9QKk88OgSoHrBrTBGYgV33Cs6xZRle_fYegph-f66aQ/s72-c/hesap.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-1835881933677115859</id><published>2012-06-09T12:44:00.001-07:00</published><updated>2012-06-09T12:44:04.199-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="actionlistener"/><category scheme="http://www.blogger.com/atom/ns#" term="adapter"/><category scheme="http://www.blogger.com/atom/ns#" term="dragged"/><category scheme="http://www.blogger.com/atom/ns#" term="Game"/><category scheme="http://www.blogger.com/atom/ns#" term="Game Progamming"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="keylistener"/><category scheme="http://www.blogger.com/atom/ns#" term="mouse motion"/><category scheme="http://www.blogger.com/atom/ns#" term="mouselistener"/><category scheme="http://www.blogger.com/atom/ns#" term="mousemotionlistener"/><category scheme="http://www.blogger.com/atom/ns#" term="on background dragging"/><category scheme="http://www.blogger.com/atom/ns#" term="pingpong"/><title type='text'>PingPong Game in Java</title><content type='html'>&lt;h2&gt;
Board.java&amp;nbsp;&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFLLQZdP4k_glsdgjWn8G6C7vuM-xesK7zY3_zDlIIw5S9pui4pg3PyOmTVXHVJH0hmPsrsnBEnzkzirqiJSyk1Z9rREMpAY84CwMSLr5naCTZbq_gZFERjsp8EvBBnl_5V1LOqmSRmJ_F/s1600/pingpong.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFLLQZdP4k_glsdgjWn8G6C7vuM-xesK7zY3_zDlIIw5S9pui4pg3PyOmTVXHVJH0hmPsrsnBEnzkzirqiJSyk1Z9rREMpAY84CwMSLr5naCTZbq_gZFERjsp8EvBBnl_5V1LOqmSRmJ_F/s640/pingpong.png&quot; width=&quot;593&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2&gt;
&amp;nbsp;&lt;/h2&gt;
&lt;pre class=&quot;brush: java&quot;&gt;import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.Timer;
public class Board extends JPanel implements ActionListener{
 
 private final int width = 600;
 private final int height = 600;
 
 private int delay = 30;//time delay to update
 private int board_x;//board x location
 private int board_y;//board y location
 private int ball_x;//ball x location
 private int ball_y;//ball y location
 private float ball_xv;//ball x violation
 private float ball_yv;//ball y violation
 
 //conditions
 private boolean running = true;
 private boolean contin= true; 
 private boolean tryagain = false;
 
 //for keyboard 
 private boolean pause = false;
 private boolean left = false;
 private boolean right = false;
 
 //for mouse motions
 private boolean dragged = false;
 private int howfarx = 0; //how far mouse click x coordinate from object&#39;s x coordinate
 
 
 private Image ball;
 private Image board;
 private Timer timer;
 private Image background;
 
 private String msg = &quot;presss&quot;;
 
 
 public Board()
 {
  addKeyListener(new TAdapter()); 
  addMouseMotionListener(new MAdapter());
  addMouseListener(new MAdapter());
  setBackground(Color.white);
  load();
  setFocusable(true);
  init();
 }
 public void load()
 {
  board = new ImageIcon(&quot;C:\\javapics\\board.png&quot;).getImage();
  ball = new ImageIcon(&quot;C:\\javapics\\ae.png&quot;).getImage();
  background = new ImageIcon(&quot;C:\\javapics\\backgroud.png&quot;).getImage();
 }
 public void actionPerformed(ActionEvent e) {
  
  if(running)
  {
      if(contin)
      {
       ballmoving();
       boardmove();
       lose();
      }
      
  }
   repaint();
 }
 public void start()
 {
  ball_xv = -0.4f;
  ball_yv = -0.3f;
  board_x = 240;
  board_y = 580;
  ball_x = 300;
  ball_y = 240;
 }
 public void init()
 {
  start();
  timer = new Timer(delay,this);
  timer.start();
 }
 public void paint(Graphics g)
 {
  super.paint(g);
  if(contin)
  {
   g.drawImage(ball, ball_x, ball_y,this);
   g.drawImage(board, board_x, board_y,this);
   Toolkit.getDefaultToolkit().sync();
   g.dispose();
  }
  if(tryagain)
  {
   String msg2 = &quot;Press Enter to try again&quot;;
         Font small = new Font(&quot;Arial&quot;, Font.BOLD, 15);

         g.setColor(Color.black);
         g.setFont(small);
         g.drawString(msg2,200,300);
         
  }
  if(pause)
  {
   String msg2 = &quot;Pause! Press Space to continue&quot;;
         Font small = new Font(&quot;Helvetica&quot;, Font.BOLD, 15);

         g.setColor(Color.black);
         g.setFont(small);
         g.drawString(msg2,200,300);
         
  }
  if(!running)
  { 
   g.drawImage(background, 0, 0,this);
  }
  
 }
 public void lose()
 {
  if(ball_y + 20 &amp;gt; height)
  { 
   contin = false;
   tryagain = true;
   
  }
  
 }
 public void ballmoving()
 {
  
  if(ball_x &amp;lt; 1)
   ball_xv = Math.abs(ball_xv);
  else if((ball_x + 20) &amp;gt; (width-21))
   ball_xv = -Math.abs(ball_xv);
  
  if(ball_y &amp;lt; 1)
   ball_yv = Math.abs(ball_yv);
  else if((ball_y+20) &amp;gt; (height-21))
   if(ball_x &amp;gt;= board_x &amp;amp;&amp;amp; ball_x &amp;lt;= (board_x+100) )
   ball_yv = -Math.abs(ball_yv);
  
  update(delay);
  
 }
 public void update(int timedelay)//to update ball location on the screen
 {
  ball_x = (ball_x + (int)(ball_xv*delay));
  ball_y = (ball_y + (int)(ball_yv*delay));
 }
 public void boardmove()//to play with keyboard
 {
  if(left){
   board_x -= 40;
   left = false;
  }
  if(right){
   board_x += 40;
   right = false;
  }
 }
 private class MAdapter extends MouseAdapter
 {
  public void mousePressed(MouseEvent e)
  {
   int mousex = e.getX();
   int mousey = e.getY();
   if(mousex &amp;gt;= board_x &amp;amp;&amp;amp; mousex &amp;lt;= (board_x+ 100))
    if(mousey &amp;gt;= board_y &amp;amp;&amp;amp; mousey &amp;lt;= (board_y+100)){
     dragged = true;
     howfarx =  mousex - board_x;
   }else {
     dragged = false;
   }
  }
  public void mouseDragged(MouseEvent e)
  { 
   if(dragged){
    board_x = e.getX() - howfarx;
    
    board_x = Math.max(0, board_x);//to prevent overflow from sides
    board_x = Math.min(board_x, (width-120));/////////////////////
   }
  }
  public void mouseExited(MouseEvent e)
  {
   dragged = false;
   howfarx = 0;
  }
  public void mouseMoved   (MouseEvent e) {}  // ignore these events
  public void mouseEntered (MouseEvent e) {}  // ignore these events
  public void mouseClicked (MouseEvent e) {}  // ignore these events
  public void mouseReleased(MouseEvent e) {}  // ignore these events
 }
 private class TAdapter extends KeyAdapter
 { 
  public void keyPressed(KeyEvent e)
  {
   int key = e.getKeyCode();
   if(key == KeyEvent.VK_Z)
   { 
    msg = &quot;pressed z&quot;;
    if((board_x - 40) &amp;gt;= 0)//to prevent overflow from left side from 
     left = true;
    else
     left = false;//nothing
   }
   if(key == KeyEvent.VK_X)
   {
    msg = &quot;pressed x&quot;;
    if((board_x + 150) &amp;lt;= width)//to prevent overflow form right side of game area
     right = true;
    else 
     right = false;//nothing
   }
   if(key == KeyEvent.VK_ENTER){
    start();
    contin = true;
    tryagain = false;
    pause = false;
   }
   if(key == KeyEvent.VK_SPACE){
    if(!pause){
    contin = false;
    pause = true;
    tryagain = false;
    }else{
     contin = true;
     pause = false;
     tryagain = false;
    }
   }
   if(key == KeyEvent.VK_ESCAPE){
    running = false;
    contin = false;
    pause = false;
    tryagain = false;
   }
  }
 }
}

&lt;/pre&gt;
&lt;br /&gt;
&lt;pinpong.java&gt;
&lt;/pinpong.java&gt;&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;import javax.swing.*;
public class pinpong extends JApplet {

 /**
  * @param args
  */
 public pinpong()
 { 
  this.setContentPane(new Board()); 
 }
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  
  JFrame window = new JFrame();
  window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        window.setSize(586, 630);
        window.setLocationRelativeTo(null);
        window.setTitle(&quot;pinpong&quot;);
        window.setContentPane(new Board());
        window.setResizable(false);
        window.setVisible(true);
 }

}

&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/1835881933677115859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/06/pingpong-game-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1835881933677115859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1835881933677115859'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/06/pingpong-game-in-java.html' title='PingPong Game in Java'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFLLQZdP4k_glsdgjWn8G6C7vuM-xesK7zY3_zDlIIw5S9pui4pg3PyOmTVXHVJH0hmPsrsnBEnzkzirqiJSyk1Z9rREMpAY84CwMSLr5naCTZbq_gZFERjsp8EvBBnl_5V1LOqmSRmJ_F/s72-c/pingpong.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-8786716867398431725</id><published>2012-04-27T14:40:00.001-07:00</published><updated>2012-06-09T11:45:03.775-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="background"/><category scheme="http://www.blogger.com/atom/ns#" term="drag"/><category scheme="http://www.blogger.com/atom/ns#" term="dragging"/><category scheme="http://www.blogger.com/atom/ns#" term="Image"/><category scheme="http://www.blogger.com/atom/ns#" term="image processing"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="javada mouse"/><category scheme="http://www.blogger.com/atom/ns#" term="kullanamak"/><category scheme="http://www.blogger.com/atom/ns#" term="mouse"/><category scheme="http://www.blogger.com/atom/ns#" term="mouse motion"/><category scheme="http://www.blogger.com/atom/ns#" term="mouselistener"/><category scheme="http://www.blogger.com/atom/ns#" term="mousemotionlistener"/><category scheme="http://www.blogger.com/atom/ns#" term="on background dragging"/><category scheme="http://www.blogger.com/atom/ns#" term="ımage"/><title type='text'>Dragging image in java</title><content type='html'>&lt;h2&gt;Draging Image dragme.java&lt;/h2&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
import javax.swing.JFrame;
public class dragme extends JFrame{
 
 public dragme(){
  
  add(new dragged());
  
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(600, 600);
        setLocationRelativeTo(null);
        setTitle(&quot;Dragging App&quot;);

        setResizable(false);
        setVisible(true);
  
 }
 
 public static void main(String[] args){
  new dragme();
 }
 
}

&lt;/pre&gt;
&lt;br&gt;
&lt;h2&gt;Dragged Image Class dragged.java&lt;/h2&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.*;

import javax.swing.*;

public class dragged extends JPanel implements MouseMotionListener, MouseListener {
 private Image Dragged;
 private Image background;
 private static int x_coord = 150;
 private static int y_coord = 150;
 private boolean isdragged;
 private static int x_dragFrom = 0;
 private static int y_dragFrom = 0;
 public dragged(){
  
  setPreferredSize(new Dimension(300,300));
  setBackground(Color.WHITE);
  this.addMouseMotionListener(this);
  this.addMouseListener(this);
  LoadImage();
  
 }
 
 public void LoadImage(){
  
  Dragged = new ImageIcon(&quot;C:\\javapics\\deneme.png&quot;).getImage();
  background = new ImageIcon(&quot;C:\\javapics\\daaad.png&quot;).getImage();
 }
 
 public void paintComponent(Graphics g){
  
  super.paintComponent(g);
  g.drawImage(background, 0, 0, null);
  g.drawImage(Dragged, x_coord, y_coord, this);
  
 }
 public void mousePressed(MouseEvent e) {
        int x = e.getX();   // Save the x coord of the click
        int y = e.getY();   // Save the y coord of the click
        
        if (x &gt;= x_coord &amp;&amp; x &amp;lt= (x_coord + Dragged.getWidth(null))
                &amp;&amp; y &gt;= y_coord &amp;&amp; y &amp;lt= (y_coord + Dragged.getWidth(null))) {
            isdragged = true;
            x_dragFrom = x - x_coord;  // how far from left
            y_dragFrom = y - y_coord;  // how far from top
        } else {
            isdragged = false;
        }
    }
  public void mouseDragged(MouseEvent e) {
         if (isdragged) {  
            
             x_coord = e.getX() - x_dragFrom;//to better dragging view
             y_coord = e.getY() - y_dragFrom;//to better dragging view
             
            //to prevent overflow left and right side
             x_coord  = Math.max(x_coord , 0);
             x_coord  = Math.min(x_coord , getWidth() - Dragged.getWidth(null));
             
             //to prevent overflow up and down side
             y_coord  = Math.max(y_coord , 0);
             y_coord  = Math.min(y_coord , getHeight() - Dragged.getHeight(null));
             
             this.repaint(); // Repaint because position changed.
         }
     }

     //we should change isdragged variable when mouse released for dragging
     public void mouseExited(MouseEvent e) {
         isdragged = false;
     }

     public void mouseMoved   (MouseEvent e) {}  // ignore these events
     public void mouseEntered (MouseEvent e) {}  // ignore these events
     public void mouseClicked (MouseEvent e) {}  // ignore these events
     public void mouseReleased(MouseEvent e) {}  // ignore these events
}

&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/8786716867398431725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/dragging-image-in-java.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/8786716867398431725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/8786716867398431725'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/dragging-image-in-java.html' title='Dragging image in java'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-6161646746838618576</id><published>2012-04-18T13:21:00.001-07:00</published><updated>2012-04-18T13:21:49.237-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Display Mode"/><category scheme="http://www.blogger.com/atom/ns#" term="engerek"/><category scheme="http://www.blogger.com/atom/ns#" term="FullScreen"/><category scheme="http://www.blogger.com/atom/ns#" term="Game"/><category scheme="http://www.blogger.com/atom/ns#" term="Game Progamming"/><category scheme="http://www.blogger.com/atom/ns#" term="Graphics"/><category scheme="http://www.blogger.com/atom/ns#" term="Graphics Card"/><category scheme="http://www.blogger.com/atom/ns#" term="GraphicsCard"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Mode"/><category scheme="http://www.blogger.com/atom/ns#" term="screen"/><category scheme="http://www.blogger.com/atom/ns#" term="Snake"/><title type='text'>Snake Game in Java</title><content type='html'>&lt;h2&gt;screen.java is using for fullscreen game develpment
&lt;/h2&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
import java.awt.*;
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
//import java.lang.reflect.InvocationTargetException;
import javax.swing.JFrame;
public class screen {

 private GraphicsDevice vc;
 
 //give vc access to monitor screen
 //Constructor
 public screen(){
  
  GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
  vc = e.getDefaultScreenDevice();
  
 }
 //get all compatible DM
 public DisplayMode[] getCompatibleDisplayModes(){
  return vc.getDisplayModes();
 }
 
 //compares DM passed in to vc DM and see if they matchs
 public DisplayMode findFirstCompatibleMode(DisplayMode modes[]){
  
  DisplayMode goodModes[] = vc.getDisplayModes();
  for(int x=0;x&amp;ltmodes.length;x++){
   for(int y=0;y&amp;ltgoodModes.length;y++){
    if(displayModesMatch(modes[x],goodModes[y])){
     return modes[x];
    }
   }
  }
  return null;
 }
 //get current DM 
 public DisplayMode getCurrentDisplayMode(){
  return vc.getDisplayMode();
 }
 
 //check if two modes match each other
 public boolean displayModesMatch(DisplayMode m1,DisplayMode m2){
  if(m1.getWidth() != m2.getWidth() || m1.getHeight() != m2.getHeight())
    return false;
  
  if(m1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI  &amp;&amp; m2.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI &amp;&amp; m1.getBitDepth() != m2.getBitDepth())
   return false;
  
  if(m1.getRefreshRate() != DisplayMode.REFRESH_RATE_UNKNOWN &amp;&amp; m2.getRefreshRate() != DisplayMode.REFRESH_RATE_UNKNOWN &amp;&amp; m1.getRefreshRate() != m2.getRefreshRate())
   return false;
  return true;
 }
 
 //make frame full screen
 public void setFullScreen(DisplayMode dm){
  JFrame f = new JFrame();
  f.setUndecorated(true);
  f.setIgnoreRepaint(true);
  f.setResizable(false);
  vc.setFullScreenWindow(f);
  
  if(dm != null &amp;&amp; vc.isDisplayChangeSupported()){
   try{
    vc.setDisplayMode(dm);
   }catch(Exception ex){} 
  }
  f.createBufferStrategy(2);
 }
 //we will set graphics object equal to this
 public Graphics2D getGraphics(){
  
  Window w = vc.getFullScreenWindow();
  if(w != null){
   BufferStrategy s = w.getBufferStrategy();
   return (Graphics2D)s.getDrawGraphics();
  }else{
   return null;
  }
  
 }
 //update display
 public void update(){
  Window w =vc.getFullScreenWindow();
  if(w != null){
   BufferStrategy s = w.getBufferStrategy();
   if(!s.contentsLost()){
    s.show();
   }
  }
 }
 //return full screen window
 public Window getFullScreenWindow(){
  return vc.getFullScreenWindow();
 }
 //get witdh of window
 public int getWidth(){
  Window w = vc.getFullScreenWindow();
  if(w != null)
   return w.getWidth();
  else 
   return 0;
 }
 
 
 //get height of window
 public int getHeight(){
   Window w = vc.getFullScreenWindow();
   if(w != null)
    return w.getHeight();
   else 
    return 0;
 }
 // get out of fullscreen
 public void restoreScreen(){
  Window w = vc.getFullScreenWindow();
  if(w != null)
   w.dispose();
  vc.setFullScreenWindow(null);
 }
 
 //create image compatible with monitor
 public BufferedImage createCompatibleImage(int w,int h,int t){
  Window win =vc.getFullScreenWindow();
  if(win != null){
   GraphicsConfiguration gc = win.getGraphicsConfiguration();
   return gc.createCompatibleImage(w,h,t);
  }
  return null;
 }
 
}

&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/6161646746838618576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/snake-game-in-java_3458.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/6161646746838618576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/6161646746838618576'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/snake-game-in-java_3458.html' title='Snake Game in Java'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-1942208493725725101</id><published>2012-04-18T13:18:00.001-07:00</published><updated>2012-04-18T13:18:21.835-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="engerek"/><category scheme="http://www.blogger.com/atom/ns#" term="Game"/><category scheme="http://www.blogger.com/atom/ns#" term="Game Progamming"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="lastmove"/><category scheme="http://www.blogger.com/atom/ns#" term="movedelay"/><category scheme="http://www.blogger.com/atom/ns#" term="variables"/><title type='text'>Snake Game in Java</title><content type='html'>&lt;pre class=&quot;brush : java&quot;&gt;

public class variables {
 
 //directions/yönler
 protected static final int kuzey = 1;
 protected static final int guney = 2;
 protected static final int bati = 3;
 protected static final int dogu = 4;
 
 //direction
 protected int yon = kuzey;
 
 //next direction
 protected int sonrakiyon = kuzey;
 
 protected long movedelay = 100; //millisecond to go or (X/V) Road/Velocity //ilerleme hızı
 protected long lastmove = 0;//time for next step
 
 //game status
 protected boolean becontinue = true;  // game is continuing //oyun devam ediyor
 protected boolean pause = false; //game is paused //oyun durduruldu
 protected boolean lost = false;//kaybettin
 protected boolean continued= false;
 //eat seed
 protected static boolean growup = false;
 protected String mess = &quot;Score = &quot;;
 protected String mess2 = &quot;Press ESC to Exit &quot;;
 protected String mess3 = &quot;Number of dead = &quot;;
 protected String mess4 = &quot;Pause&quot;;
 protected String mess5 = &quot;You LOSE&quot;;
 protected String mess6 = &quot;Try Again-Press Enter or Exit&quot;;
 protected static int score = 0;
 protected static int dead = 0;
 protected static int index ;
 
 
}

&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/1942208493725725101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/snake-game-in-java_18.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1942208493725725101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1942208493725725101'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/snake-game-in-java_18.html' title='Snake Game in Java'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-5246192838053749737</id><published>2012-04-18T13:13:00.001-07:00</published><updated>2012-04-18T13:16:27.133-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Core"/><category scheme="http://www.blogger.com/atom/ns#" term="Core class"/><category scheme="http://www.blogger.com/atom/ns#" term="Display Mode"/><category scheme="http://www.blogger.com/atom/ns#" term="Game"/><category scheme="http://www.blogger.com/atom/ns#" term="Game Progamming"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Snake"/><title type='text'>Snake Game in Java</title><content type='html'>&lt;h2&gt;engerekcore.java is need to run game&lt;/h2&gt;
&lt;pre class=&quot;brush: java&quot;&gt;

import java.awt.*;
//import javax.swing.*;

public abstract class engerekcore extends engerek{
 
 //ekran modları
 private static DisplayMode modes[] = {
  new DisplayMode(800,600,32,0),
  new DisplayMode(800,600,24,0),
  new DisplayMode(800,600,16,0),
  new DisplayMode(640,480,32,0),
  new DisplayMode(640,480,24,0),
  new DisplayMode(640,480,16,0),
 };
 private boolean running;
 protected screen s;
 
 //stop method
 public void stop(){
  running = false;
 }
 
 //call init and gameloop
 public void run(){
  try{
   init();
   start();
   gameLoop();
  }finally{
   s.restoreScreen();
  }
 }
 //set to full screen
 public void init(){
  s = new screen();
  DisplayMode dm = s.findFirstCompatibleMode(modes);
  s.setFullScreen(dm);
  
  Window w = s.getFullScreenWindow();
  w.setFont(new Font(&quot;Arial&quot;,Font.PLAIN,20));
  w.setBackground(Color.white);
  w.setForeground(Color.black);
  running = true;
 }
 //main gameLoop
 public void gameLoop(){
  long startTime = System.currentTimeMillis();
  long cumTime = startTime;
  
  while(running){
   Graphics2D g = s.getGraphics();
   long timePassed = System.currentTimeMillis() - cumTime;
   cumTime += timePassed;
   if(pause==false){
    if(lost!=false){
     try{
     draw2(g);
     g.dispose();
     
     if(continued){
     collision();
     s.update();
     continued = false;
     continue;
     }
     }catch(Exception ex){}
    }else
     update(timePassed);
     draw(g);
     g.dispose();
     s.update();
   }else{
    try{
     draw3(g);
     g.dispose();
     s.update();
     if(becontinue){
     continue;
     }
    }catch(Exception ex){}
   }
   
   try{
    Thread.sleep(20);
 
   }catch(Exception ex){}
   
  }
 }
 //update snake move
 public void update(long timePassed){
  lastmove += timePassed;
  if(lastmove&gt;movedelay){
   snakeupdate();
   if(growup==true){
   seedupdate();
   growup = false;
   }
   lastmove = 0;
  }
 }
 //draw game screen
 public abstract void draw(Graphics2D g);
 //draw lost screen
 public abstract void draw2(Graphics2D g);
 //draw pause screen
 public abstract void draw3(Graphics2D g);
}


&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/5246192838053749737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/snake-game-in-ava.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/5246192838053749737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/5246192838053749737'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/snake-game-in-ava.html' title='Snake Game in Java'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-2594378612948332477</id><published>2012-04-18T13:04:00.001-07:00</published><updated>2013-10-27T09:44:11.588-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C++"/><category scheme="http://www.blogger.com/atom/ns#" term="Cpp"/><category scheme="http://www.blogger.com/atom/ns#" term="Example"/><category scheme="http://www.blogger.com/atom/ns#" term="Inheritance"/><category scheme="http://www.blogger.com/atom/ns#" term="Magic"/><category scheme="http://www.blogger.com/atom/ns#" term="Object"/><category scheme="http://www.blogger.com/atom/ns#" term="Oriented"/><category scheme="http://www.blogger.com/atom/ns#" term="Polymorphism"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="Samples"/><title type='text'>Object Oriented Programming in Cpp</title><content type='html'>&lt;h2&gt;
Main Program main.cpp&lt;/h2&gt;
&lt;pre class=&quot;brush: cpp&quot;&gt;#include&amp;lt;iostream&amp;gt;
#include&amp;lt;string&amp;gt;
#include&amp;lt;time.h&amp;gt;

#include&quot;Land.h&quot;
#include&quot;Cost.h&quot;
#include&quot;Creature.h&quot;
#include&quot;Enchantment.h&quot;

using namespace std;

int main() { 
 srand((unsigned)time(0)); 
 Land l1(&quot;black&quot;, &quot;snow covered swamp&quot;); 
 Land l2(&quot;blue&quot;, &quot;island&quot;); 
 l1.print(); 
 // for the following array, default constructor is called 5 times 
 // let’s randomly initialize land cards in the default constructor srand called at the beginning of the code 
 Land l3[5];
 // cost object: we need total 3 manas, one of them must be 
 // red mana (the last one) color of other two manas are unimportant 
 // order of the parameters: total, white, blue, black, green, red
 Cost *cost = new Cost(3,0,0,0,0,1); 
 // parameters : name, color, ap, hp, cost, description-flavor text 
 Creature c1(&quot;anaba shaman&quot;, &quot;red&quot;, 2, 2, cost, &quot;just try taking this bull by the horns.&quot;);
 delete cost; 
 cost = new Cost(5,1,0,0,0,0); 
 Creature c2(&quot;angel of mercy&quot;,&quot;white&quot;,3,3, cost,&quot;when angel of mercy enters the battlefield, you gain 3 life.&quot;); 
 delete cost; 
 cost = new Cost(1,0,0,0,0,1); 
 Enchantment e(&quot;firebreathing&quot;, &quot;red&quot;, 1,0, cost,&quot;enchanted creature gets +1/+0 until end of turn.&quot;);
 // when a creature is enchanted, update its attack power and hit point 
 if (c2.canEnchantable(e)){
  cout &amp;lt;&amp;lt; e.getName() &amp;lt;&amp;lt; &quot; is enchantable for &quot; &amp;lt;&amp;lt; c2.getName() &amp;lt;&amp;lt; endl; 
  c2 + e; 
 } else if (c1.canEnchantable(e)){ 
  cout &amp;lt;&amp;lt; e.getName() &amp;lt;&amp;lt; &quot; is not enchantable for &quot; &amp;lt;&amp;lt; c2.getName() &amp;lt;&amp;lt; endl;
  cout &amp;lt;&amp;lt; e.getName() &amp;lt;&amp;lt; &quot; is enchantable for &quot; &amp;lt;&amp;lt; c1.getName() &amp;lt;&amp;lt; endl;
  c1 + e; 
 } else 
  cout &amp;lt;&amp;lt; e.getName() &amp;lt;&amp;lt; &quot; can’t be enchanted to any creature!&quot; &amp;lt;&amp;lt; endl;
 if (c1.isAffordable(l3,5)) 
  // if you look closely, you can see that 5 is size :) 
  cout &amp;lt;&amp;lt; c1.getName() &amp;lt;&amp;lt; &quot; is affordable according to land deck l3 &quot; &amp;lt;&amp;lt; endl;
 if (e.isAffordable(l3,5)) 
  cout &amp;lt;&amp;lt; e.getName() &amp;lt;&amp;lt; &quot; is affordable according to land deck l3&quot; &amp;lt;&amp;lt; endl; 
 // show time
 Land *l4[8]; 
 for (int i=0; i&amp;lt;5; i++)
  l4[i]=&amp;amp;l3[i]; 
 l4[5]=&amp;amp;c1;
 l4[6]=&amp;amp;c2; 
 l4[7]=&amp;amp;e; 
 for (int i=0; i&amp;lt;8; i++) 
  l4[i]-&amp;gt;print(); 
 getchar();
 return 0; 
}
&lt;/pre&gt;
&lt;h2&gt;
Land Base class cpp file Land.cpp&lt;/h2&gt;
&lt;pre class=&quot;brush: cpp&quot;&gt;#include&amp;lt;iostream&amp;gt;
#include&amp;lt;string&amp;gt;

#include &quot;Land.h&quot;

using namespace std;

Land::Land()//default constructor
{
 int random = rand()%5+1;
 switch(random){
  case 1:
   name = &quot;Plains&quot;;
   color = &quot;white&quot;;
   break;
  case 2:
   name = &quot;Island&quot;;
   color = &quot;blue&quot;;
   break;
  case 3:
   name = &quot;Swamp&quot;;
   color = &quot;black&quot;;
   break;
  case 4 :
   name = &quot;Forest&quot;;
   color = &quot;green&quot;;
   break;
  case 5: 
   name = &quot;Mountain&quot;;
   color = &quot;red&quot;;
   break;
 }
}

Land::Land(const string &amp;amp;s1,const string &amp;amp;s2)
{
 name = s1;
 color = s2;
}

void Land::print()const
{
 cout &amp;lt;&amp;lt; &quot;Name : &quot;&amp;lt;&amp;lt; name &amp;lt;&amp;lt; &quot;  Color : &quot;&amp;lt;&amp;lt; color &amp;lt;&amp;lt; endl;
}
&lt;/pre&gt;
&lt;h2&gt;
Land Base class header file Land.h&lt;/h2&gt;
&lt;pre class=&quot;brush: cpp&quot;&gt;#ifndef LAND_H
#define LAND_H
#include&amp;lt;string&amp;gt;
#include&amp;lt;time.h&amp;gt;
#include&amp;lt;cstdlib&amp;gt;
using namespace std;

class Land{//Base Class
private :
 string name;
 string color;
public :
 Land();//default constructor
 Land(const string &amp;amp;,const string &amp;amp;);//copy constructor
 string getname()const {return name;}//return name variable
 string getcolor()const {return color;}//return color variable
 virtual void print()const;//virtual function from polymorphism
};

#endif
&lt;/pre&gt;
&lt;h2&gt;
Creature Derived Class header file Creature.h&lt;/h2&gt;
&lt;pre class=&quot;brush: cpp&quot;&gt;#ifndef CREATURE_H
#define CREATURE_H
#include&amp;lt;string&amp;gt;
#include &quot;Enchantment.h&quot;
#include &quot;Land.h&quot;
#include &quot;Cost.h&quot;

using namespace std;

class Creature: public Land  //public inhertance base class is Land
{
private :
 int ap;//attack point
 int hp;//hit point
 Cost *c1; //Cost pointer 
 string description;//description of creature
public :
 Creature(const string &amp;amp;,const string &amp;amp;,int AP,int,Cost *,const string &amp;amp;);//Constructor
 bool canEnchantable(const Enchantment &amp;amp;);//to control is Creature&#39;s color is useful for Land
 string getName()const{return Land::getname();}//return name variable
 bool isAffordable(const Land *,int);//to control is mana enough for Creature
 void print()const; //virtual function from polymorphism
 void operator+(const Enchantment &amp;amp;); //operator overloading
 ~Creature(){delete c1;}//Destructor
};
#endif
&lt;/pre&gt;
&lt;h2&gt;
Creature Derived Class cpp file Creature.cpp&lt;/h2&gt;
&lt;pre class=&quot;brush: cpp&quot;&gt;#include&amp;lt;iostream&amp;gt;
#include&amp;lt;string&amp;gt;

#include &quot;Creature.h&quot;

using namespace std;

Creature::Creature(const string &amp;amp;s1,const string &amp;amp;s2,int AP,int HP,Cost *cost,const string &amp;amp;s3):Land(s1,s2)
{
  ap = AP;
  hp = HP;
  c1 = new Cost(cost-&amp;gt;getTotal(),cost-&amp;gt;getWhite(),cost-&amp;gt;getBlue(),cost-&amp;gt;getBlack(),cost-&amp;gt;getGreen(),cost-&amp;gt;getRed());
  description = s3;
}

bool Creature::canEnchantable(const Enchantment &amp;amp;e)
{
  if(Land::getcolor().compare(e.getColor())==0)//compare function in string library return integer value
   return true;
  else
   return false;
}

void Creature::print()const //virtual function from polymorphism
{
  Land::print(); // virtual  base print function
  cout &amp;lt;&amp;lt; &quot;Attack Point : &quot; &amp;lt;&amp;lt; ap &amp;lt;&amp;lt; &quot;\n&quot;
         &amp;lt;&amp;lt; &quot;Hit Point : &quot; &amp;lt;&amp;lt; hp &amp;lt;&amp;lt; &quot;\n&quot;
  &amp;lt;&amp;lt; &quot;Total Mana : &quot; &amp;lt;&amp;lt; c1-&amp;gt;getTotal() &amp;lt;&amp;lt; &quot;\n&quot;
  &amp;lt;&amp;lt; Land::getcolor() &amp;lt;&amp;lt;&quot; Mana : &quot; &amp;lt;&amp;lt; c1-&amp;gt;getmana() &amp;lt;&amp;lt; &quot;\n&quot;
  &amp;lt;&amp;lt; description &amp;lt;&amp;lt; endl;
}

void Creature::operator+(const Enchantment &amp;amp;e) //operator overloading
{
  ap = ap + e.getAp();
  hp = hp + e.getHp();
}

bool Creature::isAffordable(const Land *l,int size)
{ //Mana Array&#39;s size = 5 and it includes number of mana colors
 int manas[5] = {0,0,0,0,0};//White,Blue,Black,Green,Red
 if(c1-&amp;gt;getTotal()&amp;gt;size)
   return false;
 else{
  for(int i = 0;i&amp;lt;size;i++){
   if(l[i].getcolor().compare(&quot;white&quot;)==0)
    //increment number of White Mana
    manas[0]++;
   if(l[i].getcolor().compare(&quot;blue&quot;)==0)
    //increment number of Blue Mana
    manas[1]++;     
   if(l[i].getcolor().compare(&quot;black&quot;)==0)
    //increment number of Black Mana
    manas[2]++; 
   if(l[i].getcolor().compare(&quot;green&quot;)==0)
    //increment number of Green Mana
    manas[3]++;
   if(l[i].getcolor().compare(&quot;red&quot;)==0)
    //increment number of Red Mana
    manas[4]++;
  }
  if(Land::getcolor().compare(&quot;white&quot;)==0){
   if(c1-&amp;gt;getWhite() &amp;lt;= manas[0])
    return true;
  }else if(Land::getcolor().compare(&quot;blue&quot;)==0){
   if(c1-&amp;gt;getBlue() &amp;lt;= manas[1])
    return true;
  }else if(Land::getcolor().compare(&quot;black&quot;)==0){
   if(c1-&amp;gt;getBlack() &amp;lt;= manas[2])
    return true;
  }else if(Land::getcolor().compare(&quot;green&quot;)==0){
   if(c1-&amp;gt;getGreen() &amp;lt;= manas[3])
    return true;
  }else if(Land::getcolor().compare(&quot;red&quot;)==0){
   if(c1-&amp;gt;getRed() &amp;lt;= manas[4])
    return true;
  }
  return false;
 }
}
&lt;/pre&gt;
&lt;h2&gt;
Enchantment Derived Class header file Enchantment.h&lt;/h2&gt;
&lt;pre class=&quot;brush: cpp&quot;&gt;#ifndef ENCHANTMENT_H
#define ENCHANTMENT_H
#include&amp;lt;string&amp;gt;
#include &quot;Cost.h&quot;
#include &quot;Land.h&quot;

using namespace std;

class Enchantment : public Land //public inhertance base class is Land
{
private :
 int inc_ap;//increment atack point
 int inc_hp;//increment hit point;
 string description;//description of enchantment
 Cost *c2;//Cost pointer
public :
 Enchantment(const string &amp;amp;,const string &amp;amp;,int AP,int HP,Cost *,const string &amp;amp;);//Constructor
 string getColor()const{return Land::getcolor();}//get method to access private member called color in base class Land
 string getName()const{return Land::getname();}//get method to access private member called name in base class Land

 bool isAffordable(const Land *,int);//To control is mana enough for Enchantment 
 
 void print()const; //virtual function from polymorphism
 
 int getAp()const {return inc_ap;}//get method to access private inc_ap
 int getHp()const {return inc_hp;}//get method to access private inc_hp
 ~Enchantment(){delete c2;}//destructor
};

#endif
&lt;/pre&gt;
&lt;h2&gt;
Enchantment Derived Class cpp file Enchantment.cpp&lt;/h2&gt;
&lt;pre class=&quot;brush: cpp&quot;&gt;#include&amp;lt;iostream&amp;gt;
#include&amp;lt;string&amp;gt;

#include &quot;Enchantment.h&quot;

using namespace std;

bool Enchantment::isAffordable(const Land *l,int size)
{
 int manas[5] = {0,0,0,0,0}; //White,Blue,Black,Green,Red
 if(c2-&amp;gt;getTotal()&amp;gt;size)
   return false;
 else{
  for(int i = 0;i&amp;lt;size;i++){
   if(l[i].getcolor().compare(&quot;white&quot;)==0)
    //increment number of White Mana
    manas[0]++;
   if(l[i].getcolor().compare(&quot;blue&quot;)==0)
    //increment number of White Mana
    manas[1]++;     
   if(l[i].getcolor().compare(&quot;black&quot;)==0)
    //increment number of White Mana
    manas[2]++; 
   if(l[i].getcolor().compare(&quot;green&quot;)==0)
    //increment number of White Mana
    manas[3]++;
   if(l[i].getcolor().compare(&quot;red&quot;)==0)
    //increment number of White Mana
    manas[4]++;
  }
  if(Land::getcolor().compare(&quot;white&quot;)==0){
   if(c2-&amp;gt;getWhite() &amp;lt;= manas[0])
    return true;
  }else if(Land::getcolor().compare(&quot;blue&quot;)==0){
   if(c2-&amp;gt;getBlue() &amp;lt;= manas[1])
    return true;
  }else if(Land::getcolor().compare(&quot;black&quot;)==0){
   if(c2-&amp;gt;getBlack() &amp;lt;= manas[2])
    return true;
  }else if(Land::getcolor().compare(&quot;green&quot;)==0){
   if(c2-&amp;gt;getGreen() &amp;lt;= manas[3])
    return true;
  }else if(Land::getcolor().compare(&quot;red&quot;)==0){
   if(c2-&amp;gt;getRed() &amp;lt;= manas[4])
    return true;
  } 
  return false; 
 }
} 

void Enchantment::print()const //virtual function from polymorphism
{
  Land::print();//virtual base print function
  cout &amp;lt;&amp;lt; &quot;Increment Attack Point by : &quot; &amp;lt;&amp;lt; inc_ap &amp;lt;&amp;lt; &quot;\n&quot;
   &amp;lt;&amp;lt;  &quot;Increment Hit Point by : &quot; &amp;lt;&amp;lt; inc_hp &amp;lt;&amp;lt; &quot;\n&quot;
   &amp;lt;&amp;lt; &quot;Total Mana : &quot; &amp;lt;&amp;lt; c2-&amp;gt;getTotal() &amp;lt;&amp;lt; &quot;\n&quot;
   &amp;lt;&amp;lt; Land::getcolor() &amp;lt;&amp;lt; &quot; Mana : &quot; &amp;lt;&amp;lt; c2-&amp;gt;getmana() &amp;lt;&amp;lt; &quot;\n&quot;
   &amp;lt;&amp;lt; description &amp;lt;&amp;lt; endl;
  
}

Enchantment::Enchantment(const string &amp;amp;s,const string &amp;amp;s2,int AP,int HP,Cost *cost,const string &amp;amp;s3):Land(s,s2)
{ 
  // Constructor
  inc_ap = AP;
  inc_hp = HP;
  c2 = new Cost(cost-&amp;gt;getTotal(),cost-&amp;gt;getWhite(),cost-&amp;gt;getBlue(),cost-&amp;gt;getBlack(),cost-&amp;gt;getGreen(),cost-&amp;gt;getRed());
  description = s3;
}
&lt;/pre&gt;
&lt;h2&gt;
Cost Class header file Cost.h&lt;/h2&gt;
&lt;pre class=&quot;brush: cpp&quot;&gt;#ifndef COST_H
#define COST_H

using namespace std;

class Cost{
private :
 int Total;
 int White;
 int Blue;
 int Black;
 int Green;
 int Red;
public :
 Cost(int,int,int,int,int,int);
 int getmana()const;
 int getTotal()const {return Total;}
 int getWhite()const {return White;}
 int getBlue()const {return Blue;}
 int getBlack()const {return Black;}
 int getGreen()const {return Green;}
 int getRed()const {return Red;}
};

#endif
&lt;/pre&gt;
&lt;h2&gt;
Cost Class cpp file Cost.cpp&lt;/h2&gt;
&lt;pre class=&quot;brush: cpp&quot;&gt;#include&amp;lt;iostream&amp;gt;
#include&amp;lt;string&amp;gt;

#include &quot;Cost.h&quot;

using namespace std;

Cost::Cost(int total,int white,int blue,int black,int green,int red)
{
 Total = total;
 White = white;
 Blue = blue;
 Black = black;
 Green = green;
 Red = red;
}

int Cost::getmana()const
{
 if(White!=0)
  return White;
 else if(Blue!=0)
  return Blue;
 else if(Black!=0)
  return Black;
 else if(Green!=0)
  return Green;
 else if(Red!=0)
  return Red;
 else
  return 0;
}
&lt;/pre&gt;
&lt;h2&gt;
OUTPUT&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW_AFRp3yBJdZiZOALvIydMmBapDMmWYnv4dpl4OxziYCwO0wJPaDZPCCNm_RA1PD1MFiBMCmLLXSgomzGsce4plBvnra9z47aboulkfBrdR_fTTVpXuSmsofRAdEaubCS7_o80Vr_Etx8/s1600/dawdas.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;384&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW_AFRp3yBJdZiZOALvIydMmBapDMmWYnv4dpl4OxziYCwO0wJPaDZPCCNm_RA1PD1MFiBMCmLLXSgomzGsce4plBvnra9z47aboulkfBrdR_fTTVpXuSmsofRAdEaubCS7_o80Vr_Etx8/s640/dawdas.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/2594378612948332477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/object-oriented-programming-in-cpp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/2594378612948332477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/2594378612948332477'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/object-oriented-programming-in-cpp.html' title='Object Oriented Programming in Cpp'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW_AFRp3yBJdZiZOALvIydMmBapDMmWYnv4dpl4OxziYCwO0wJPaDZPCCNm_RA1PD1MFiBMCmLLXSgomzGsce4plBvnra9z47aboulkfBrdR_fTTVpXuSmsofRAdEaubCS7_o80Vr_Etx8/s72-c/dawdas.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-8169798961148093252</id><published>2012-04-17T09:06:00.001-07:00</published><updated>2012-04-17T09:06:41.021-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Midterm"/><category scheme="http://www.blogger.com/atom/ns#" term="Signal"/><category scheme="http://www.blogger.com/atom/ns#" term="Signals"/><category scheme="http://www.blogger.com/atom/ns#" term="Signals and Systems"/><category scheme="http://www.blogger.com/atom/ns#" term="System"/><category scheme="http://www.blogger.com/atom/ns#" term="Systems"/><category scheme="http://www.blogger.com/atom/ns#" term="vize"/><title type='text'>Signals and Systems</title><content type='html'>&lt;h2&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sinyaller ve Sistemler çıkmış vize soruları&lt;/h2&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgE_hT4PyFNtcZYZhLmbSuMQug4a5zk_GnluUlbByokAhGZP7e3VqyItkSH-t7cBP7Mc8tgDLmdVWxRC9LbUH9YHPlQcPNwxj7KxjqsQFPEUkQRvputwP9Ze67JKv3olzDGY4VHqsWYPSUD/s1600/tel.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;462&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgE_hT4PyFNtcZYZhLmbSuMQug4a5zk_GnluUlbByokAhGZP7e3VqyItkSH-t7cBP7Mc8tgDLmdVWxRC9LbUH9YHPlQcPNwxj7KxjqsQFPEUkQRvputwP9Ze67JKv3olzDGY4VHqsWYPSUD/s640/tel.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/8169798961148093252/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/signals-and-systems.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/8169798961148093252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/8169798961148093252'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/signals-and-systems.html' title='Signals and Systems'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgE_hT4PyFNtcZYZhLmbSuMQug4a5zk_GnluUlbByokAhGZP7e3VqyItkSH-t7cBP7Mc8tgDLmdVWxRC9LbUH9YHPlQcPNwxj7KxjqsQFPEUkQRvputwP9Ze67JKv3olzDGY4VHqsWYPSUD/s72-c/tel.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-8352309101542656952</id><published>2012-04-12T03:52:00.001-07:00</published><updated>2012-04-12T03:53:29.788-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="8 bit"/><category scheme="http://www.blogger.com/atom/ns#" term="8bit"/><category scheme="http://www.blogger.com/atom/ns#" term="clock"/><category scheme="http://www.blogger.com/atom/ns#" term="counter"/><category scheme="http://www.blogger.com/atom/ns#" term="logic"/><category scheme="http://www.blogger.com/atom/ns#" term="mmlogic"/><category scheme="http://www.blogger.com/atom/ns#" term="ripple"/><category scheme="http://www.blogger.com/atom/ns#" term="ripple counter"/><title type='text'>Ripple Counter</title><content type='html'>8 bit Ripple Counter&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;279&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOO9WRnmLCjKKjB6O51gedcrmA1ZhIpW6pz4jvOyrV3Q0w6hv08kOj_tVZIUC8xkrVgIO-soB3urPGPG2z37svNOsgBIjT_06ObP09ibJte2c-_PgsGZ1KK68xJonhj7K0WJF252s0Cg3k/s640/blog.png&quot; title=&quot;&quot; width=&quot;640&quot; /&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://web.itu.edu.tr/yilmazburk/blog.png&quot; target=&quot;_blank&quot;&gt;Ripple Counter&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/8352309101542656952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/ripple-counter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/8352309101542656952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/8352309101542656952'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/ripple-counter.html' title='Ripple Counter'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOO9WRnmLCjKKjB6O51gedcrmA1ZhIpW6pz4jvOyrV3Q0w6hv08kOj_tVZIUC8xkrVgIO-soB3urPGPG2z37svNOsgBIjT_06ObP09ibJte2c-_PgsGZ1KK68xJonhj7K0WJF252s0Cg3k/s72-c/blog.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-6613416853436715463</id><published>2012-04-11T12:43:00.001-07:00</published><updated>2012-04-12T03:44:13.064-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Bağlantılı liste"/><category scheme="http://www.blogger.com/atom/ns#" term="Cpp"/><category scheme="http://www.blogger.com/atom/ns#" term="Linked List"/><title type='text'>Linked List/Bağlantılı liste</title><content type='html'>&lt;h2&gt;List Example with cpp
  / Bağlantılı liste örneği&lt;/h2&gt;
&lt;pre class=&quot;brush: cpp&quot;&gt;
#include&amp;ltiostream&gt;
#include&amp;ltstring&gt;
#include&amp;ltstdlib.h&gt;
#include&amp;ltstdio.h&gt;
#include&amp;ltiomanip&gt;
#include&amp;ltctype.h&gt;

using namespace std;
#include &quot;Kayit.h&quot;
typedef struct listeDugumu listeDugumu;
typedef listeDugumu *listeDugumuPtr;


void ekle(listeDugumuPtr *,listeDugumu *,int);
void listeyazdir(listeDugumuPtr);
int bosMu(listeDugumuPtr);
void sil(listeDugumuPtr *,int,int);
void menu(void);
void listebosalt(listeDugumuPtr *);
//void listeyibol(listeDugumuPtr *,int);
int main(){

 listeDugumuPtr baslangicPtr=NULL;
 listeDugumu *kayitPtr;
 kayitPtr =new listeDugumu;
 int dugumsayisi=0;
 int sirano;
 menu();
 int secim;
 cout &amp;lt&amp;lt &quot;? : &quot;;
 cin &gt;&gt; secim;
 
 while(secim!=8){
   
  switch(secim){
  case 1 :
   cout &amp;lt&amp;lt &quot;Lutfen eklemek istediginiz kisinin bilgilerini giriniz&quot; &amp;lt&amp;lt endl;
   cout &amp;lt&amp;lt &quot;Eklenecek ismi giriniz : &quot;;
   cin.ignore(1000, &#39;\n&#39;);
   cin.getline(kayitPtr-&gt;isim,AD_UZUNLUK);
      cout &amp;lt&amp;lt&quot;Eklenecek Telefon numarasi : &quot;;
   cin &gt;&gt; setw(TEL_UZUNLUK) &gt;&gt; kayitPtr-&gt;tel_numarasi;
   cout &amp;lt&amp;lt endl;
   ekle(&amp;baslangicPtr,kayitPtr,dugumsayisi);
      listeyazdir(baslangicPtr);
   break;
  case 2 :
    if(!bosMu(baslangicPtr)){
    cout &amp;lt&amp;lt &quot;Silinecek siranoyu giriniz :&quot;;
    cin &gt;&gt; sirano;
    sil(&amp;baslangicPtr,sirano,dugumsayisi);
    cout &amp;lt&amp;lt &quot;Kayit silindi&quot; &amp;lt&amp;lt endl;
    }else
     cout &amp;lt&amp;lt &quot;liste bos&quot; &amp;lt&amp;lt endl;
         break;
  case 3 : 
   listebosalt(&amp;baslangicPtr);
     cout &amp;lt&amp;lt &quot;liste bosaltildi...&quot; &amp;lt&amp;lt endl;
   break;
  /*case 4 :
   cout &amp;lt&amp;lt &quot;listeyi kaca bolmek istiyorsunuz ?&quot; &amp;lt&amp;lt endl;
   cin &gt;&gt; kac;
   listeyibol(&amp;baslangicPtr,dugumsayisi);
   break;
   */
  default:
   cout &amp;lt&amp;lt &quot;Yanlis bir giris yaptiniz tekrar giriniz&quot; &amp;lt&amp;lt endl;
   menu();
        break;
       }
  cout &amp;lt&amp;lt &quot;? : &quot;; 
  cin &gt;&gt; secim;
 }
 cout &amp;lt&amp;lt &quot;program kapatılıyor&quot;;
 delete kayitPtr;
 
 return EXIT_SUCCESS;
}
void menu(void){
cout &amp;lt&amp;lt &quot;1-Kayit ekle&quot; &amp;lt&amp;lt endl;
cout &amp;lt&amp;lt &quot;2-Kayit sil&quot; &amp;lt&amp;lt endl;
cout &amp;lt&amp;lt &quot;3-Listeyi bosalt&quot; &amp;lt&amp;lt endl;
cout &amp;lt&amp;lt &quot;4-Listeyi ikiye bol&quot; &amp;lt&amp;lt endl;
cout &amp;lt&amp;lt &quot;8-Cikis&quot; &amp;lt&amp;lt endl;
  
}
void ekle(listeDugumuPtr *sPtr,listeDugumu *savePtr,int dugum_sayisi){
 listeDugumuPtr tara,arka,yeni;
  tara=*sPtr;
  yeni = new listeDugumu;
        *yeni=*savePtr;
  yeni-&gt;sonrakiPtr=NULL;
  if(*sPtr==NULL){
  *sPtr=yeni;//ilk düğüm ekleniyor
  dugum_sayisi++;
  return;
     }
  if(strcmp(yeni-&gt;isim,(*sPtr)-&gt;isim)&lt;0)
  {
   yeni-&gt;sonrakiPtr=*sPtr;//Basa ekleniyor
   *sPtr=yeni;
   dugum_sayisi++;
   return;
  }
  while(tara &amp;&amp; strcmp(yeni-&gt;isim,tara-&gt;isim)&gt;0)
  {
  arka=tara;
  tara=tara-&gt;sonrakiPtr;
  
  }
  if(tara){
   yeni-&gt;sonrakiPtr=tara;//araya ekleniyor
   arka-&gt;sonrakiPtr=yeni;
   
  }
  else
   arka-&gt;sonrakiPtr=yeni;//sona ekleniyor
      dugum_sayisi++;
}
void listeyazdir(listeDugumuPtr suandakiPtr){
 int i=1;
 if(suandakiPtr==NULL)
  cout &amp;lt&amp;lt &quot;Rehber bos&quot; &amp;lt&amp;lt endl;
 else{
  cout &amp;lt&amp;lt &quot;Liste : &quot; &amp;lt&amp;lt endl;
    while(suandakiPtr!=NULL){
     cout &amp;lt&amp;lt i &amp;lt&amp;lt suandakiPtr-&gt;isim &amp;lt&amp;lt &quot;\t&quot; &amp;lt&amp;lt suandakiPtr-&gt;tel_numarasi &amp;lt&amp;lt endl;
     suandakiPtr=suandakiPtr-&gt;sonrakiPtr;
     i++;
    }
 }
}
int bosMu(listeDugumuPtr basPtr){
   return basPtr==NULL;
}
void sil(listeDugumuPtr *sPtr,int sira,int dugum_sayisi){
 listeDugumuPtr tara,arka;
 int sayac=1;
 tara=*sPtr;
 if(sira&amp;lt=0){
  cout &amp;lt&amp;lt &quot;yanlis sira no girdiniz&quot; &amp;lt&amp;lt endl;
  return;
 }
 if(sira==1){
 *sPtr=(*sPtr)-&gt;sonrakiPtr;
 delete tara;
 dugum_sayisi--;
 return;
 }
 while(tara &amp;&amp; (sayac&amp;ltsira)){
 arka=tara;
 tara=tara-&gt;sonrakiPtr;
 sayac++;
 }
 if(sayac&amp;ltsira)
  cout &amp;lt&amp;lt &quot;silinecek kayit bulunamadi&quot; &amp;lt&amp;lt endl;
 else{
  arka-&gt;sonrakiPtr=tara-&gt;sonrakiPtr;
     delete tara;
     dugum_sayisi--;

 }
    
}
void listebosalt(listeDugumuPtr *sPtr){
   listeDugumuPtr tara;
   
    if(*sPtr==NULL)
  cout &amp;lt&amp;lt &quot;liste bos&quot; &amp;lt&amp;lt endl;
 else 
  while(*sPtr){
     tara=*sPtr;
  *sPtr=(*sPtr)-&gt;sonrakiPtr;
  delete tara;
  }

}&lt;/pre&gt;
&lt;h2&gt;
kayit.h is a header file for liste_example.cpp&lt;/h2&gt;
&lt;br&gt;
&lt;pre class=&quot;brush: cpp&quot;&gt;
#define AD_UZUNLUK 30
#define TEL_UZUNLUK 15
struct listeDugumu{
char isim[AD_UZUNLUK];
char tel_numarasi[TEL_UZUNLUK];
struct listeDugumu *sonrakiPtr;
};
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/6613416853436715463/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/blog-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/6613416853436715463'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/6613416853436715463'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/blog-post.html' title='Linked List/Bağlantılı liste'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-3450756597140950539</id><published>2012-04-11T12:11:00.001-07:00</published><updated>2012-04-11T12:12:16.496-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Game"/><category scheme="http://www.blogger.com/atom/ns#" term="Game Progamming"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="keylistener"/><category scheme="http://www.blogger.com/atom/ns#" term="Snake"/><title type='text'>Snake Game in Java</title><content type='html'>&lt;h2&gt;
keyinputs.class is to use keylistener and keybord inputs
&lt;/h2&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
import java.awt.event.*;
import java.awt.*;
public class keyinputs extends engerekcore implements KeyListener{
 public static void main(String[] args){
  new keyinputs().run();
 }
 
 
 public String tostring(int a){
  return mess+&quot;&quot;+a;
 }
 public String tostring2(int a){
  return mess3+&quot;&quot;+a;
 }
 public int getsonrakiyon(){
  return sonrakiyon;
 }
 public void init(){
  super.init();
  Window w = s.getFullScreenWindow();
  w.setFocusTraversalKeysEnabled(false);
  w.addKeyListener(this);
 }
 
 //keypressed
 public void keyPressed(KeyEvent e){
  int keyCode = e.getKeyCode();
  
  if(keyCode == KeyEvent.VK_ENTER){//to stop //oyunu durdurur
   pause = true;
   becontinue = false;
  }
  if(keyCode == KeyEvent.VK_SPACE){
   pause = false;
   becontinue = true;
  } 
  if(keyCode == KeyEvent.VK_BACK_SPACE)
   continued = true;
  if(keyCode == KeyEvent.VK_ESCAPE){//to exit //oyundan çıkar
   stop();
  }else{
   yon = sonrakiyon;
   if(keyCode == KeyEvent.VK_W)
    if(yon!=kuzey &amp;&amp; yon!=guney)
    sonrakiyon = kuzey;
   if(keyCode == KeyEvent.VK_S)
    if(yon!=guney &amp;&amp; yon!=kuzey)
    sonrakiyon = guney;
   if(keyCode == KeyEvent.VK_A)
    if(yon!=bati &amp;&amp; yon!=dogu)
    sonrakiyon = bati;
   if(keyCode == KeyEvent.VK_D)
    if(yon!=dogu &amp;&amp; yon!=bati)
    sonrakiyon = dogu;
   e.consume();
  }
 }
 
 //keyReleased
 public void keyReleased(KeyEvent e){
  e.consume();
 }
 
 //last method from interface
 public void keyTyped(KeyEvent e){
  e.consume();
 }
 //engerekcoredaki draw metoduyla eş zamanlı çalışır//run in the same time with draw method in engerekcore  
 public synchronized void draw(Graphics2D g){
  
  Window w = s.getFullScreenWindow();//tam ekrana geçiş
  g.setColor(w.getBackground());//arka ekran rengi
  g.fillRect(0, 0, s.getWidth(), s.getHeight());
  g.setColor(w.getForeground());//ön ekran rengi
  g.setFont(new Font(&quot;Matisse ITC&quot;,1,18));//yazı biçimi
  for(int i=0;i&amp;ltcoord.size();i++)//yılanın ekrana bastırılması //drawing snake
   g.drawImage(coord.get(i).gethead(),coord.get(i).getx(),coord.get(i).gety(),null);
  for(int j=0;j&amp;lt=780;j+=20){
   g.drawImage(wall,j,0,null);
   g.drawImage(wall,j,560,null);
   }
  for(int k=0;k&amp;lt=560;k+=20){
   g.drawImage(wall,0,k,null);
   g.drawImage(wall,780,k,null);
   }
  for(int m = 0;m&amp;lt8;m++)//yemin ekrana bastırılması //drawing seed
  g.drawImage(food.get(m).gethead(),food.get(m).getx(),food.get(m).gety(),null);
  g.drawString(tostring(score),570 ,595);
  g.drawString(mess2,100,595);
  g.drawString(tostring2(dead), 300, 595);
 }
 public synchronized void draw2(Graphics2D g){
  Window w = s.getFullScreenWindow();
  g.setColor(w.getBackground());
  g.fillRect(0, 0, s.getWidth(), s.getHeight());
  g.setColor(w.getForeground());
  g.setFont(new Font(&quot;Matisse ITC&quot;,1,50));
  g.drawString(mess5, 300, 250);
  g.drawString(mess6, 100, 350);
 }
 public synchronized void draw3(Graphics2D g){
  Window w = s.getFullScreenWindow();
  g.setColor(w.getBackground());
  g.fillRect(0, 0, s.getWidth(), s.getHeight());
  g.setColor(w.getForeground());
  g.setFont(new Font(&quot;Matisse ITC&quot;,1,50));
  g.drawString(mess4, 300, 250);
 }
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/3450756597140950539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/snake-game-in-java_11.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/3450756597140950539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/3450756597140950539'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/snake-game-in-java_11.html' title='Snake Game in Java'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-4604146144199562977</id><published>2012-04-08T08:03:00.001-07:00</published><updated>2012-04-08T08:04:20.914-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Codes"/><category scheme="http://www.blogger.com/atom/ns#" term="engerek"/><category scheme="http://www.blogger.com/atom/ns#" term="Game"/><category scheme="http://www.blogger.com/atom/ns#" term="Game Progamming"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Snake"/><title type='text'>Snake Game in Java</title><content type='html'>&lt;h2&gt;
 engerek.class is to creat snake and update position of snake
&lt;/h2&gt;

&lt;pre class=&quot;brush: java&quot;&gt;import java.util.ArrayList;
import javax.swing.*;
import java.awt.Image;
//import java.math.*;
public class engerek extends variables{

//inner class
 protected class ekans{
 private double x;
 private double y;
 private Image head;
 //default constructor
 public ekans(){
  this.head = kelle;
  this.x = 0.0;
  this.y = 0.0;
 }
 //constructor
 public ekans(Image i,double a,double b){
  this.head = i;
  this.x = a;
  this.y = b;
 }
 public Image gethead(){
  return head;
 }
 public int getx(){
  return (int)x;}
 public int gety(){
  return (int)y;}
 public void setxy(double x,double y){
  this.x = x;
  this.y = y;
 }
 }
 protected Image askelle = new ImageIcon(&quot;C:\\Users\\engerek\\images\\aw.png&quot;).getImage();//to load Snake head image
 protected Image kelle = new ImageIcon(&quot;C:\\Users\\engerek\\images\\ae.png&quot;).getImage();//to Load Snake image
 protected Image wall = new ImageIcon(&quot;C:\\Users\\engerek\\images\\ay.png&quot;).getImage(); //to Load WALL image
 protected Image yem = new ImageIcon(&quot;C:\\Users\\engerek\\images\\as.png&quot;).getImage();//to Load Seed image 
 ArrayList&amp;lt;ekans&amp;gt; coord = new ArrayList&amp;lt;ekans&amp;gt;();
 ArrayList&amp;lt;ekans&amp;gt; food = new ArrayList&amp;lt;ekans&amp;gt;();
 public void addtile(Image i,int coorx,int coory){
  coord.add(0,new ekans(i,coorx,coory));
 }
 
 public void start(){
  addtile(kelle,320,300);
  addtile(kelle,300,300);
  addtile(kelle,280,300);
  addtile(kelle,260,300);
  addtile(kelle,240,300);
  addtile(kelle,220,300);
  food.add(new ekans(yem,300,400));
  food.add(new ekans(askelle,500,500));
  food.add(new ekans(yem,440,440));
  food.add(new ekans(askelle,100,100));
 }
 public Image load(Image i){
  i = new ImageIcon(&quot;C:\\javapics\\deadly.png&quot;).getImage();
     return i;
 }
 public void seedupdate(){
  double xco,yco;
  boolean tamamdir = false;
  while(tamamdir==false){
  xco = Math.random()*20;
  yco = Math.random()*20;
  xco = 20 + Math.round(xco)*40;
  yco = 20 + Math.round(yco)*40;
  for(int i = 0;i&amp;lt;coord.size();i++)
   if(xco!=coord.get(i).x &amp;amp;&amp;amp; yco != coord.get(i).y){
    if(xco&amp;lt;760 &amp;amp;&amp;amp; yco&amp;lt;560 )
    if(yco&amp;gt;20 &amp;amp;&amp;amp; xco&amp;gt;20){
     if(index%2==1){
      food.remove(index);
      food.add(index,new ekans(yem,xco,yco));
     }else{
      food.remove(index);
      food.add(index,new ekans(askelle,xco,yco));
     }
    tamamdir = true;
    }
   }
  }
 }
 public void snakeupdate(){
  ekans e = coord.get(0); //ekans object is pointed first element of arraylist
  ekans newmove = new ekans();
  yon = sonrakiyon;
  switch(yon){
  case kuzey :
   newmove.x = e.x;
   newmove.y = e.y - 20.0;
   break;
  case guney : 
   newmove.x = e.x;
   newmove.y = e.y + 20.0;
   break;
  case bati :
   newmove.x = e.x - 20.0;
   newmove.y = e.y;
   break;
  case dogu :
   newmove.x = e.x + 20.0;
   newmove.y = e.y;
   break;
  }
  
  //collision of snake with walls
  if(newmove.x&amp;lt;20){
   lost = true;
   return;
  }if(newmove.x&amp;gt;780){
   lost = true;
   return;
  }if(newmove.y&amp;lt;20){
   lost = true;
   return;
  }if(newmove.y&amp;gt;560){
   lost = true;
   return;
  }
  //collision of snake with itself
  for(int i=0;i&amp;lt;coord.size();i++){
   if(newmove.x == coord.get(i).x &amp;amp;&amp;amp; newmove.y == coord.get(i).y){
    lost = true;
    break;
   }
  }
  //eating seed and growing up
  for(int i = 0;i&amp;lt;food.size();i++)
  if(newmove.x==food.get(i).getx() &amp;amp;&amp;amp; newmove.y == food.get(i).gety()){
  growup = true;
  score += 5;
  index = i;
  break;
  }
  if(growup==true){
  coord.add(0,newmove);
  }else{
   coord.add(0,newmove);
   coord.remove(coord.size()-1);
  }
   
 }
 //if collision is occur then snake starts up again
 public void collision(){
  coord.removeAll(coord);
  start();
  score = 0;
  dead++;
  lost = false;
  sonrakiyon = kuzey;
 }
}

&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/4604146144199562977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/snake-game-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/4604146144199562977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/4604146144199562977'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/04/snake-game-in-java.html' title='Snake Game in Java'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-1614689338512556622</id><published>2012-03-15T12:05:00.002-07:00</published><updated>2012-03-15T12:06:45.399-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Cpp"/><category scheme="http://www.blogger.com/atom/ns#" term="string"/><title type='text'>string library</title><content type='html'>&lt;pre class=&quot;brush: cpp&quot;&gt;
#include&amp;ltiostream&gt;
#include&amp;ltconio.h&gt;
#include&amp;ltstring&gt;
typedef string stringer
void main(){
   stringer mailto = &quot;yilmazburk@gmail.com&quot;;
   cout &amp;lt&amp;lt mailto &amp;lt&amp;lt endl;
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/1614689338512556622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/03/string-library.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1614689338512556622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1614689338512556622'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/03/string-library.html' title='string library'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-8965647467320462618</id><published>2012-03-13T15:31:00.002-07:00</published><updated>2012-03-13T15:32:00.657-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Cpp"/><category scheme="http://www.blogger.com/atom/ns#" term="Getline"/><title type='text'>Problem Getline is solved</title><content type='html'>&lt;h2&gt;Getline function sometimes runs badly i mean it&#39;s work useless for us so i can help you about getline&#39;s useless
&lt;/h2&gt;
&lt;pre class=&quot;brush : cpp&quot;&gt;
/***************************************************************************** 

   using getline function/getline fonksiyonun istenildiği gibi kullanılması

******************************************************************************/
#include&amp;ltstring&gt;
#include&amp;ltiostream&gt;

using namespace std;

void main(){
string film_name,country;
bool oscar;
int duration,number_of_actors;
double imdb_rating;
string getliner;

cout &amp;lt&amp;lt &quot;Please enter film&#39;s name : &quot; &amp;lt&amp;lt &quot;\n&quot;;
cin.ignore(0,&#39;\n&#39;); //not read space and nextline character
getline(cin,film_name);

cout  &amp;lt&amp;lt &quot;Please enter film&#39;s year : &quot;&amp;lt&amp;lt endl;
cin &gt;&gt; year;

cout  &amp;lt&amp;lt &quot;Please enter film&#39;s duration : &quot;&amp;lt&amp;lt endl;
cin &gt;&gt; duration;

cout  &amp;lt&amp;lt &quot;Please enter number of actors : &quot;&amp;lt&amp;lt endl;
cin &gt;&gt; number_of_actors;
getline(cin,getliner);

cout  &amp;lt&amp;lt &quot;Please enter film&#39;s country : &quot;&amp;lt&amp;lt &quot;\n&quot;;
cin.ignore(0,&#39;\n&#39;);  //not read space and nextline character
getline(cin,country);

cout  &amp;lt&amp;lt &quot;Does the film have Oscar 0 or 1 : &quot;&amp;lt&amp;lt endl;
cin &gt;&gt; oscar;

cout  &amp;lt&amp;lt &quot;Please enter imdb rating of the film : &quot;&amp;lt&amp;lt endl;
cin &gt;&gt; imdb_rating;
getline(cin,getliner);

cout &amp;lt&amp;lt &quot;Film added&quot; &amp;lt&amp;lt endl;

cin.clear();
}
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/8965647467320462618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/03/problem-getline-is-solved.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/8965647467320462618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/8965647467320462618'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/03/problem-getline-is-solved.html' title='Problem Getline is solved'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-2936723868585424066</id><published>2012-03-03T09:13:00.001-08:00</published><updated>2012-10-14T12:48:40.692-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="2 Dimensional"/><category scheme="http://www.blogger.com/atom/ns#" term="Allocation"/><category scheme="http://www.blogger.com/atom/ns#" term="Array"/><category scheme="http://www.blogger.com/atom/ns#" term="Arrays"/><category scheme="http://www.blogger.com/atom/ns#" term="Matrix"/><category scheme="http://www.blogger.com/atom/ns#" term="Memory"/><category scheme="http://www.blogger.com/atom/ns#" term="Pointer"/><title type='text'>Memory Allocation in cpp with 2 Dimensional Arrays</title><content type='html'>&lt;h2&gt;




Operation on matrices with pointers/Pointerlar ve Diziler Üzerinde hafıza işlemleri&lt;/h2&gt;
&lt;pre class=&quot;brush : cpp&quot;&gt;/***********************************************************
Memory Allocation and Matrices Operations with pointers
************************************************************/
#include &amp;lt;iostream&amp;gt;
#include &amp;lt;ctimegt&amp;gt;
#include &amp;lt;cstdlibgt&amp;gt;
using namespace std;
/**********************************************************************************
*FONKSİYONUN ADI: multip_matrix
*ALDIĞI PARAMETRELER: int** ve int
*DÖNÜŞ DEĞERİ: void
*AMACI: İki boyutlu 2 diziyi matris ve işaretçi aritmetiğine göre çarpan fonksiyon
**********************************************************************************/
void multip_matrix(int **a, int **b, int **c, int k, int m, int n){

 int i,j,l;
 int sum=0;
 for(l=0;l&amp;lt;n;l++)
  for(i=0;i&amp;lt;k;i++){
   for(j=0;j&amp;lt;m;j++){
    sum+=*(*(b+j)+l)**(*(a+i)+j);
   }
   *(*(c+i)+l) = sum;
   sum = 0;
  }
}
/**********************************************************************************
*FONKSİYONUN ADI: multip_array
*ALDIĞI PARAMETRELER: int* ve int
*DÖNÜŞ DEĞERİ: void
*AMACI: Tek boyutlu 2 diziyi matris ve işaretçi aritmetiğine göre çarpan fonksiyon
**********************************************************************************/
void multip_array(int *a, int *b, int *c, int k, int m, int n){
 int i,j,l;
 int sum = 0;
 for(l=0;l&amp;lt;n;l++)
  for(i=0;i&amp;lt;k;i++){
   for(j=0;j&amp;lt;m;j++)
   sum += *(a+j+i*k)**(b+j*n+l);
   *(c+i*n+l) = sum;
   sum = 0;
  }
}
int main(){
srand(time(NULL));
 int k,m,n;
 int x = 0;
 int i,j,z,l;
 int sayac = 0;
 cout &amp;lt;&amp;lt;  &quot;Matrislerin Boyutlarini Girin (k,m,n seklinde)&quot; &amp;lt;&amp;lt;endl;
 cin &amp;gt;&amp;gt; k &amp;gt;&amp;gt; m &amp;gt;&amp;gt; n;
 
 //a dizisi için hafızadan yer alınıyor ve dizi oluşturuluyor
 int **a;
 a = new int*[k];
 for(i=0;i&amp;lt;k;i++)
  a[i] = new int[m];
 for(j=0;j&amp;lt;k;j++)
  for(z=0;z&amp;lt;m;z++)
   a[j][z] = rand()%6;
 //a dizisinin elemanlar ekrana bastırılıyor
 cout &amp;lt;&amp;lt; &quot;1.matris&quot;&amp;lt;&amp;lt;endl;
 for(i=0;i&amp;lt;k;i++)
  for(j=0;j&amp;lt;m;j++){
   cout &amp;lt;&amp;lt; a[i][j]&amp;lt;&amp;lt;&quot; &quot;;
   sayac++;
   if(sayac == m){
    cout&amp;lt;&amp;lt;endl;
    sayac = 0; 
   }
  }
 cout &amp;lt;&amp;lt; endl;

 //b dizisi için hafızadan yer alınıyor ve dizi oluşturuluyor
 int **b ;
 b = new int*[m];
 for(i=0;i&amp;lt;m;i++)
  b[i] = new int[n];
 for(j=0;j&amp;lt;m;j++)
  for(z=0;z&amp;lt;n;z++)
   b[j][z] = rand()%6;
 //b dizisinin elemanlar ekrana bastırılıyor
 cout &amp;lt;&amp;lt; &quot;2.matris&quot;&amp;lt;&amp;lt;endl;
 for(i=0;i&amp;lt;m;i++)
  for(j=0;j&amp;lt;n;j++){
   cout &amp;lt;&amp;lt; b[i][j]&amp;lt;&amp;lt;&quot; &quot;;
   sayac++;
   if(sayac == n){
    cout&amp;lt;&amp;lt;endl;
    sayac = 0; 
   }
  }
  
 cout &amp;lt;&amp;lt; endl;

 //c dizisi için hafızadan yer alınıyor ve dizi oluşturuluyor
 int **c = new int*[k];
 for(i=0;i&amp;lt;k;i++)
  c[i] = new int[n];
 
 system(&quot;pause&quot;);
 //multip_matrix fonksiyon çağrısı
 multip_matrix(a,b,c,k,m,n);

 //multip matrix fonksiyonu ile oluşturulan iki boyutlu çarpım dizisinin ekrana bastırılması
 cout &amp;lt;&amp;lt; &quot;carpim matrisi&quot;&amp;lt;&amp;lt;endl;
 for(i=0;i&amp;lt;k;i++)
  for(j=0;j&amp;lt;n;j++){
   printf(&quot;%2d &quot;,c[i][j]);
   sayac++;
   if(sayac == n){
    cout&amp;lt;&amp;lt;endl;
    sayac = 0; 
   }
  }
 //tek boyutlu diziler icin hafızadan yer alınıyor
 int *dizi1 = new int[k*m];
 int *dizi2 = new int[m*n];
 int *dizi3 = new int[k*n];
  
 for(i=0;i&amp;lt;k;i++)
  for(j=0;j&amp;lt;m;j++){
   dizi1[x] = a[i][j];
   x++;
  }
  x=0;
 for(i=0;i&amp;lt;m;i++)
  for(j=0;j&amp;lt;n;j++){
   dizi2[x] = b[i][j];
   x++;
  }
 cout&amp;lt;&amp;lt;endl;
 system(&quot;pause&quot;);
 //multip_array fonksiyon çağrısı
 multip_array(dizi1,dizi2,dizi3,k,m,n);
 //multip array fonksiyonu ile oluşturulan tek boyutlu çarpım dizisinin ekrana bastırılması
 for(i=0;i&amp;lt;k*n;i++)
  cout&amp;lt;&amp;lt; *(dizi3+i) &amp;lt;&amp;lt;&quot; &quot;;
  cout&amp;lt;&amp;lt;endl;
  
 //Her bir dizi için bellekten alınan yerler geri veriliyor 
for(i=0;i&amp;lt;k*m;i++)
 delete  a[i];//Try This
 delete [] a;
for(i=0;i&amp;lt;m*n;i++)
 delete  b[i];//Try This
 delete [] b;
 delete [] dizi1;
 delete [] dizi2;
 delete [] dizi3;

 system(&quot;pause&quot;);
 
return 0;
}
&lt;/pre&gt;
&lt;h2&gt;




Ekran çıktısı aşağıdaki gibidir&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-nGruLio0jHA0zBgzYoEF2I1Xjf7zeJ4l5O9rLdx6PlTZlrPgmep86SqLLxon03sJVPFsYM9MuA2TfEiPVprIs9WUPytzfvgmkCuJw1GIeOCzCpwJ6x4NPTDkHdfpYHIFR7GjbSg-dAnE/s1600/Ads%25C4%25B1z.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;316&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-nGruLio0jHA0zBgzYoEF2I1Xjf7zeJ4l5O9rLdx6PlTZlrPgmep86SqLLxon03sJVPFsYM9MuA2TfEiPVprIs9WUPytzfvgmkCuJw1GIeOCzCpwJ6x4NPTDkHdfpYHIFR7GjbSg-dAnE/s640/Ads%25C4%25B1z.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/2936723868585424066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/03/memory-allocation-in-cpp-with-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/2936723868585424066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/2936723868585424066'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/03/memory-allocation-in-cpp-with-2.html' title='Memory Allocation in cpp with 2 Dimensional Arrays'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-nGruLio0jHA0zBgzYoEF2I1Xjf7zeJ4l5O9rLdx6PlTZlrPgmep86SqLLxon03sJVPFsYM9MuA2TfEiPVprIs9WUPytzfvgmkCuJw1GIeOCzCpwJ6x4NPTDkHdfpYHIFR7GjbSg-dAnE/s72-c/Ads%25C4%25B1z.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-2167734847138762250</id><published>2012-02-11T05:10:00.000-08:00</published><updated>2012-02-19T03:03:20.267-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Image"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Java-Adding an Image</title><content type='html'>&lt;h2&gt;images.java&lt;/h2&gt;
If you want to debug this class, then you should use class that FullScreen.java 
&lt;pre class=&quot;brush : java&quot;&gt;
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.ImageIcon;
public class images extends JFrame{

 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  DisplayMode dm = new DisplayMode(800,600,16,DisplayMode.REFRESH_RATE_UNKNOWN);
  images i = new images();
  i.run(dm);
 } 
  
 private FullScreen s; 
 private Image bg;
 private Image pic;
        private Image ani;
 private boolean loaded;
 //run method
 public void run(DisplayMode dm){
  setBackground(Color.WHITE);
  setForeground(Color.BLACK);
  setFont(new Font(&quot;Arial&quot;,Font.PLAIN,24));
  loaded = false;
  s = new  FullScreen();
  try{
   s.setFullScreen(dm, this);
   loadpics();
   try{
    
    Thread.sleep(3000);//milliseconds
    
   }catch(Exception ex){}
  }finally{
   s.restoreScreen();
  }
 }
 
 //load pictures
 public void loadpics(){
  bg = new ImageIcon(&quot;C:\\anywhere.jpg&quot;).getImage();
  pic = new ImageIcon(&quot;C:\\anywhere.png&quot;).getImage();
                ani = new ImageIcon(&quot;C:\\anywhere.gif&quot;).getImage();
  loaded = true;
  repaint();
 }
 
 public void paint(Graphics g){
  if(g instanceof Graphics2D){
   Graphics2D g2 = (Graphics2D)g;
   g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  }
  if(loaded){
   g.drawImage(bg, 30, 30, null);
   g.drawImage(pic, 170, 180, null);
   g.drawImage(ani,100,100,null);
  }
  
 }
 
 
}

&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/2167734847138762250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/02/java-adding-image.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/2167734847138762250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/2167734847138762250'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/02/java-adding-image.html' title='Java-Adding an Image'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-6453154270102219447</id><published>2012-02-10T08:07:00.000-08:00</published><updated>2012-02-10T08:10:11.847-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="FullScreen"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Java-Full Screen App</title><content type='html'>&lt;h2&gt;burkan.java&lt;/h2&gt;
&lt;pre class=&quot;brush : java&quot;&gt;

import java.awt.*;
import javax.swing.JFrame;
public class burkan extends JFrame{

 /**
  * @param args
  */
public static void main(String[] args) {
 // TODO Auto-generated method stub
 DisplayMode dm = new DisplayMode(800,600,16,DisplayMode.REFRESH_RATE_UNKNOWN);
 burkan b = new burkan();
 b.run(dm);
}

public void run(DisplayMode dm){
    setBackground(Color.WHITE);
    setForeground(Color.BLACK);
    setFont(new Font(&quot;Arial&quot;,Font.PLAIN,24));
  
    FullScreen s = new  FullScreen();
    try{
    s.setFullScreen(dm, this);
    try{
  
    Thread.sleep(3000);
   
    }catch(Exception ex){}
    }finally{
    s.restoreScreen();
    }
}
 
public void paint(Graphics g){
 if(g instanceof Graphics2D){
  Graphics2D g2 = (Graphics2D)g;
  g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
 }
  g.drawString(&quot;Hello World!!!&quot;, 200, 200);
 } 
}

&lt;/pre&gt;
&lt;h2&gt;FullScreen.java&lt;/h2&gt;
&lt;pre class=&quot;brush : java&quot;&gt;
import javax.swing.JFrame;
import java.awt.*;
public class FullScreen {
 private GraphicsDevice vc;
 
 public FullScreen(){
  
  GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
  vc = env.getDefaultScreenDevice();
  
 }
 
 public void setFullScreen(DisplayMode dm,JFrame window){
  
  window.setUndecorated(true);
  window.setResizable(false);
  vc.setFullScreenWindow(window);
  
  if(dm != null &amp;&amp; vc.isDisplayChangeSupported()){
   
   try{
    vc.setDisplayMode(dm);
   }catch(Exception ex){}
   
  }
 }
 public Window getFullScreenWindow(){
 
  return vc.getFullScreenWindow();
 
 }
 
 public void restoreScreen(){
  Window w = vc.getFullScreenWindow();
  if(w != null){
   w.dispose();
  }
  vc.setFullScreenWindow(null);
 }
  
}

&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/6453154270102219447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/02/java-full-screen-app.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/6453154270102219447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/6453154270102219447'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/02/java-full-screen-app.html' title='Java-Full Screen App'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-123174850003842960</id><published>2012-02-04T04:06:00.000-08:00</published><updated>2012-02-10T08:02:53.738-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="JFrame"/><category scheme="http://www.blogger.com/atom/ns#" term="Thread"/><title type='text'>Java - Thread</title><content type='html'>&lt;h2&gt;burkan.java&lt;/h2&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
import javax.swing.*;
public class burkan {
 public static void main(String[] args){
   
  
 Thread t1 = new Thread(new threads(300,300,1500));
 Thread t2 = new Thread(new threads(250,250,3500));
 Thread t3 = new Thread(new threads(200,200,6500));
 Thread t4 = new Thread(new threads(100,100,8500));
 Thread t5 = new Thread(new threads(50,50,10500));
   
 t1.start();
 t2.start();
 t3.start();
 t4.start();
 t5.start();
 }
}

&lt;/pre&gt;
&lt;br&gt;
&lt;br&gt;
&lt;h2&gt;graphics.java&lt;/h2&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class graphics extends JPanel{
 private int a,b;
 public graphics(int i, int j) {
   //constructor
   a=i;
   b=j;
 }

 public void paintComponent(Graphics g){
 super.paintComponents(g);
 this.setBackground(Color.WHITE);
   
 g.setColor(Color.blue);
 g.drawRect(100,100, a, b);
    
  }
    
  
   
  
}
&lt;/pre&gt;
&lt;br&gt;
&lt;br&gt;
&lt;h2&gt;threads.java&lt;/h2&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
import java.util.*;
import java.awt.*;
import javax.swing.*;
 public class threads implements Runnable{
 private int x,y;
 public int time;
 public JFrame f = new JFrame(&quot;LOOP&quot;);
 
 public threads(int a,int b,int t){
  //constructor
  x=a;
  y=b;
  time = t;
  
 }
 
 
    public void run(){
     
     try{
      Thread.sleep(time);
   graphics p = new graphics(x,y);

   f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   f.setSize(800,600);
   f.setVisible(true);
   f.add(p);
     
     }catch(Exception e){}
     
    }
}

&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/123174850003842960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/02/burkan.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/123174850003842960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/123174850003842960'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/02/burkan.html' title='Java - Thread'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-4244170874078685533</id><published>2012-01-17T12:15:00.000-08:00</published><updated>2012-01-17T12:15:59.041-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Veri yapıları"/><title type='text'>Örnek Veri Yapıları Finali</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2n1souiCr6BkRoaDVLChMmTvfNmKApC1hHHILmkuE_7FcZ9s6pNG_n8f91FOf5Aq42Rra4LRMWel_Uf2JF4rv_FesIzoMnyrXymmVrulZUUF-dUeaiURkTUoqsWWHaU9RS9mZzvnjGKdp/s1600/final+1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2n1souiCr6BkRoaDVLChMmTvfNmKApC1hHHILmkuE_7FcZ9s6pNG_n8f91FOf5Aq42Rra4LRMWel_Uf2JF4rv_FesIzoMnyrXymmVrulZUUF-dUeaiURkTUoqsWWHaU9RS9mZzvnjGKdp/s640/final+1.jpg&quot; width=&quot;464&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFzQekqDB1Y5Ah7oxATFkT75PLMVHn2uTPU1E6-IkVP852VF2cAus40qKq1bYeHynmX75wSHVwCbBAy9GkiOAVeJHABMXbOPIub_qoLE8LUWucXisn6xlY1nQWsx5c4TqXcyuYBiAAQ2fl/s1600/final+2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFzQekqDB1Y5Ah7oxATFkT75PLMVHn2uTPU1E6-IkVP852VF2cAus40qKq1bYeHynmX75wSHVwCbBAy9GkiOAVeJHABMXbOPIub_qoLE8LUWucXisn6xlY1nQWsx5c4TqXcyuYBiAAQ2fl/s640/final+2.jpg&quot; width=&quot;465&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/4244170874078685533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/01/ornek-veri-yaplar-finali.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/4244170874078685533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/4244170874078685533'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/01/ornek-veri-yaplar-finali.html' title='Örnek Veri Yapıları Finali'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2n1souiCr6BkRoaDVLChMmTvfNmKApC1hHHILmkuE_7FcZ9s6pNG_n8f91FOf5Aq42Rra4LRMWel_Uf2JF4rv_FesIzoMnyrXymmVrulZUUF-dUeaiURkTUoqsWWHaU9RS9mZzvnjGKdp/s72-c/final+1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-1086265102279172164</id><published>2012-01-16T10:55:00.000-08:00</published><updated>2012-01-16T10:58:38.804-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Array"/><category scheme="http://www.blogger.com/atom/ns#" term="Binary Tree"/><category scheme="http://www.blogger.com/atom/ns#" term="Cpp"/><category scheme="http://www.blogger.com/atom/ns#" term="Time.h"/><title type='text'>How to create binary tree</title><content type='html'>&lt;pre class=&quot;brush: cpp&quot;&gt;
#include&amp;ltiostream&amp;gt
#include&amp;ltstdio.h&amp;gt
#include&amp;lttime.h&amp;gt
#include&amp;ltiomanip&amp;gt
#include&amp;ltconio.h&amp;gt
#define dimension 11
using namespace std;

struct tree{
 int value;
 tree *leftptr;
 tree *rightptr;
};
typedef tree Tree;
typedef Tree *treePtr;
void create(treePtr *,int);
void silme(treePtr *);
void remove(treePtr);
void inorder(treePtr);
void postorder(treePtr);
void preorder(treePtr);
void go_array(treePtr,int[],int *);
void main(){
 srand(time(NULL));
 int val,i,key;  //val means value, i means counter , key is keyboard input
 int counter=0;
 int arrayx[dimension]={0};
 treePtr root = NULL;
 for(i=0;i&amp;lt11;i++){

  val = rand()%999+1;
  create(&amp;root,val);
 }

 go_array(root,arrayx,&amp;counter);
 cout &amp;lt&amp;lt &quot;inorder scanning...&quot; &amp;lt&amp;lt endl;
 inorder(root);
 cout &amp;lt&amp;ltendl&amp;lt&amp;lt&quot;Preorder scanning...&quot;&amp;lt&amp;ltendl;
 preorder(root);
 cout &amp;lt&amp;ltendl&amp;lt&amp;lt&quot;Postorder scanning...&quot;&amp;lt&amp;ltendl;
 postorder(root);
 cout&amp;lt&amp;ltendl;
 cout &amp;lt&amp;lt &quot;Array : &quot;&amp;lt&amp;ltendl;
 for(i=0;i&amp;lt11;i++)
  cout &amp;lt&amp;ltarrayx[i] &amp;lt&amp;lt&quot;  &quot;;
 cout&amp;lt&amp;ltendl;
 cout &amp;lt&amp;lt&quot;Sayac = &quot;&amp;lt&amp;ltcounter&amp;lt&amp;ltendl;
 cout &amp;lt&amp;ltendl&amp;lt&amp;lt &quot;Press 1 to delete a node from to tree or 0 to pass and exit : &quot;;
 cin.ignore(0,&#39;\n&#39;);
 cin&amp;gt&amp;gtkey;
 cout &amp;lt&amp;lt key&amp;lt&amp;ltendl;
 if(key==1)
 remove(root);
 inorder(root);
 getch();
}
void create(treePtr *proot,int qvalue){
 treePtr tara,yeni;
 yeni = new Tree;
 tara = *proot;
 yeni-&amp;gtvalue=qvalue;
 yeni-&amp;gtleftptr = NULL;
 yeni-&amp;gtrightptr = NULL;
 bool bulundu = false;
 if((*proot)==NULL){//ilk düğüm ekleniyor
  *proot = yeni;
 }
 while(tara!=NULL &amp;&amp; bulundu!=true){
  if(qvalue&amp;lttara-&amp;gtvalue){
   if(tara-&amp;gtleftptr!=NULL)
    tara=tara-&amp;gtleftptr;
   else{
    tara-&amp;gtleftptr = yeni;
    bulundu = true;
   }     
  }
  else if(qvalue&amp;gttara-&amp;gtvalue){
    if(tara-&amp;gtrightptr!=NULL)
     tara=tara-&amp;gtrightptr;
    else{
     tara-&amp;gtrightptr = yeni;
     bulundu = true;
    }
  }
  else 
   break;
 }
}
void inorder(treePtr p){
 if(p){
  inorder(p-&amp;gtleftptr);
  cout &amp;lt&amp;lt p-&amp;gtvalue &amp;lt&amp;lt&quot;  &quot;;
  inorder(p-&amp;gtrightptr);
 }
}
void postorder(treePtr p){
 if(p){
  inorder(p-&amp;gtleftptr);
  inorder(p-&amp;gtrightptr);
  cout &amp;lt&amp;lt p-&amp;gtvalue &amp;lt&amp;lt&quot;  &quot;;
  
 }
}
void preorder(treePtr p){
 if(p){
  cout &amp;lt&amp;lt p-&amp;gtvalue &amp;lt&amp;lt&quot;  &quot;;
  inorder(p-&amp;gtleftptr);
  inorder(p-&amp;gtrightptr);
 }
}
void go_array(treePtr p,int q[dimension],int *s){

 if(p){
  
  go_array(p-&amp;gtleftptr,q,s);
  q[*s]=p-&amp;gtvalue;
  (*s)++;
  go_array(p-&amp;gtrightptr,q,s);
  
  
 }
}
void remove(treePtr p){
 
 int sil;
 cout &amp;lt&amp;lt &quot;NE SILMEK ISTIYORSUN : &quot;;
 cin.ignore(2,&#39;\n&#39;);
 cin &amp;gt&amp;gt sil;
 char yon;
 treePtr tara,ust;
 tara = p;
 bool var = false;
 while(tara &amp;&amp; var!=true){
  if(sil&amp;lttara-&amp;gtvalue){
    ust=tara;
    yon = &#39;l&#39;;
    tara=tara-&amp;gtleftptr;
  }else if(sil&amp;gttara-&amp;gtvalue){
    ust=tara;
    yon = &#39;r&#39;;
    tara=tara-&amp;gtrightptr;
  }else
   var = true;
 }
 if(var==true){
  if(yon==&#39;l&#39;)
   silme(&amp;(ust-&amp;gtleftptr));
  else if(yon==&#39;r&#39;)
   silme(&amp;(ust-&amp;gtrightptr));
  else 
   silme(&amp;p);
 }
 else
  cout &amp;lt&amp;lt &quot;HATA&quot; &amp;lt&amp;ltendl;

}
void silme(treePtr *s){
 treePtr r,q;
 r=*s;
 if(r==NULL)
  return;
 else if(r-&amp;gtrightptr==NULL){
  *s=r-&amp;gtleftptr;
  delete r;
 }
 else if(r-&amp;gtleftptr==NULL){
  *s=r-&amp;gtrightptr;
  delete r;
 }
 else {
  for(q=r-&amp;gtrightptr;q-&amp;gtleftptr;q=q-&amp;gtleftptr);
  q=r-&amp;gtleftptr;
  *s=r-&amp;gtrightptr;
  delete r;
 }

}

&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/1086265102279172164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/01/how.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1086265102279172164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/1086265102279172164'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/01/how.html' title='How to create binary tree'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1771903383381188295.post-323605450079239589</id><published>2012-01-16T10:45:00.000-08:00</published><updated>2012-01-16T11:00:17.232-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogspot"/><category scheme="http://www.blogger.com/atom/ns#" term="Codes"/><category scheme="http://www.blogger.com/atom/ns#" term="Highlighter"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="Syntax"/><title type='text'>Syntax Highligter 3 and Blogspot</title><content type='html'>Syntax Highlighter version 3.0.83 has been released and there are quite a few changes in the way things work now. I realized this when the rendering on this site broke after I modified it to use the latest release. So, here is the steps required to setup the &quot;hosted&quot; version of the latest Syntax Highlighter (version 3.0.83) and integrate with your Blogger/Blogspot blog.
&lt;br /&gt;

&lt;h1&gt;

Installation&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to &lt;b&gt;&lt;i&gt;Dashboard &amp;gt; Design &amp;gt; Edit HTML&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Backup the current template by clicking on the link &lt;b&gt;&lt;i&gt;Download Full Template&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;In the textarea, press &lt;i&gt;CTRL+F&lt;/i&gt; to find the code &lt;b&gt;&lt;i&gt;&amp;lt;/head&amp;gt;&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Copy the below code and paste it just above &lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;brush: javascript&quot;&gt;
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js&quot; type=&quot;text/javascript&quot;&gt;
 
&lt;script src=&#39;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js&#39; type=&#39;text/javascript&#39;/&gt;
&lt;script src=&#39;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js&#39; type=&#39;text/javascript&#39;/&gt;
&lt;script src=&#39;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js&#39; type=&#39;text/javascript&#39;/&gt;
&lt;script src=&#39;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js&#39; type=&#39;text/javascript&#39;/&gt;
&lt;script src=&#39;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js&#39; type=&#39;text/javascript&#39;/&gt;
&lt;script src=&#39;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js&#39; type=&#39;text/javascript&#39;/&gt;
&lt;script src=&#39;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js&#39; type=&#39;text/javascript&#39;/&gt;
&lt;script src=&#39;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js&#39; type=&#39;text/javascript&#39;/&gt;
&lt;script src=&#39;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js&#39; type=&#39;text/javascript&#39;/&gt;
 
&lt;script language=&#39;javascript&#39; type=&#39;text/javascript&#39;&gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighli
&lt;/script&gt;
&lt;/pre&gt;
And Save it if you want to add another languages,&lt;a href=&quot;http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/&quot;&gt;gooo.&lt;/a&gt;
&lt;pre class=&quot;brush: javascript&quot;&gt;
&amp;ltlink href=&#39;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&#39; rel=&#39;stylesheet&#39; type=&#39;text/css&#39;/&amp;gt
&lt;/pre&gt;
Moreover,you can replace shThemeDefault in the above line with any one of the following themes:&lt;br /&gt;
Django - shThemeDjango&lt;br /&gt;
Eclipse - shThemeEclipse&lt;br /&gt;
Emacs - shThemeEmacs&lt;br /&gt;
Fade to Grey - shThemeFadeToGrey&lt;br /&gt;
Midnight - shThemeMidnight&lt;br /&gt;
RDark - shThemeRDark&lt;br /&gt;
&lt;h1&gt;


Usage&lt;/h1&gt;
To use it in your blog post, there are a couple of things that need to be done.&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Escape all code by replacing any occurrences of:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt; &lt;b&gt;&lt;i&gt;&amp;lt;&lt;/i&gt;&lt;/b&gt; with &lt;b&gt;&lt;i&gt;&amp;amp;lt;&lt;/i&gt;&lt;/b&gt; &lt;/li&gt;
&lt;li&gt; &lt;b&gt;&lt;i&gt;&amp;gt;&lt;/i&gt;&lt;/b&gt; with &lt;b&gt;&lt;i&gt;&amp;amp;gt;&lt;/i&gt;&lt;/b&gt; &lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt; Enclose the escaped code between &lt;b&gt;&lt;i&gt;&amp;lt;pre class=&quot;brush:[brush_name];[optional_params]&quot;&amp;gt;&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;&amp;lt;/pre&amp;gt;&lt;/i&gt;&lt;/b&gt; &lt;/li&gt;
&lt;li&gt; Setup the proper brush name (based on the code being highlighted) 
in the opening pre tag. Using the correct brush will ensure proper 
highlighting of the code&lt;/li&gt;
&lt;/ol&gt;</content><link rel='replies' type='application/atom+xml' href='http://burkanyilmaz.blogspot.com/feeds/323605450079239589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/01/syntax-highligter-3-and-blogspot.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/323605450079239589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1771903383381188295/posts/default/323605450079239589'/><link rel='alternate' type='text/html' href='http://burkanyilmaz.blogspot.com/2012/01/syntax-highligter-3-and-blogspot.html' title='Syntax Highligter 3 and Blogspot'/><author><name>Burkan YILMAZ</name><uri>http://www.blogger.com/profile/13824547449590189660</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>