亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? demo11_3.cpp

?? 一個完整的基于DirectX的射擊游戲 沒有使用OO
?? CPP
字號:
// DEMO11_3.CPP - a binary search tree demo

// INCLUDES ///////////////////////////////////////////////////////////////

#define WIN32_LEAN_AND_MEAN  // make sure certain headers are included correctly

#include <windows.h>         // include the standard windows stuff
#include <windowsx.h>        // include the 32 bit stuff
#include <conio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <math.h>
#include <io.h>
#include <fcntl.h>

// DEFINES ///////////////////////////////////////////////////////////////

// TYPES //////////////////////////////////////////////////////////////////

typedef struct TNODE_TYP
   {
   int id;         // id number of this object
   int age;        // age of person
   char name[32];  // name of person
   TNODE_TYP *right; // this is the link to the right node
   TNODE_TYP *left;  // this is the link to the left node               

   // more fields go here
   } TNODE, *TNODE_PTR;


// PROTOTYPES ////////////////////////////////////////////////////////////

void BST_Inorder_Search(TNODE_PTR root);
void BST_Preorder_Search(TNODE_PTR root);
void BST_Postorder_Search(TNODE_PTR root);
TNODE_PTR BST_Insert_Node(TNODE_PTR root, int id, int age, char *name); 

// GLOBALS //////////////////////////////////////////////////////////////

TNODE_PTR root = NULL; // root of tree

// FUNCTIONS ////////////////////////////////////////////////////////////

TNODE_PTR BST_Insert_Node(TNODE_PTR root, int id, int age, char *name)
{
// test for empty tree
if (root==NULL)
   {
   // insert node at root
   root         = new(TNODE);
   root->id     = id;
   root->age    = age;
   strcpy(root->name,name);

   // set links to null
   root->right  = NULL;
   root->left   = NULL;

   printf("\nCreating tree");

   } // end if

// else there is a node here, lets go left or right
else
if (age >= root->age)
   {
   printf("\nTraversing right...");
   // insert on right branch

   // test if branch leads to another sub-tree or is terminal
   // if leads to another subtree then try to insert there, else
   // create a node and link
   if (root->right)
      BST_Insert_Node(root->right, id, age, name);
   else
      {
      // insert node on right link
      TNODE_PTR node   = new(TNODE);
      node->id     = id;
      node->age    = age;
      strcpy(node->name,name);

      // set links to null
      node->left   = NULL;
      node->right  = NULL;

      // now set right link of current "root" to this new node
      root->right = node;

      printf("\nInserting right.");

      } // end else

   } // end if
else // age < root->age
   {
   printf("\nTraversing left...");
   // must insert on left branch

   // test if branch leads to another sub-tree or is terminal
   // if leads to another subtree then try to insert there, else
   // create a node and link
   if (root->left)
      BST_Insert_Node(root->left, id, age, name);
   else
      {
      // insert node on left link
      TNODE_PTR node   = new(TNODE);
      node->id     = id;
      node->age    = age;
      strcpy(node->name,name);

      // set links to null
      node->left   = NULL;
      node->right  = NULL;

      // now set right link of current "root" to this new node
      root->left = node;

      printf("\nInserting left.");
      } // end else

} // end else

// return the root 
return(root);

} // end BST_Insert_Node


//////////////////////////////////////////////////////////////////////////

void BST_Inorder_Search(TNODE_PTR root)
{
// this searches a BST using the inorder search

// test for NULL
if (!root)
   return;

// traverse left tree
BST_Inorder_Search(root->left);

// visit the node
printf("\nname: %s, age: %d", root->name, root->age);

// traverse the right tree
BST_Inorder_Search(root->right);

} // end BST_Inorder_Search

///////////////////////////////////////////////////////////////////

void BST_Preorder_Search(TNODE_PTR root)
{
// this searches a BST using the preorder search

// test for NULL
if (!root)
   return;

// visit the node
printf("\nname: %s, age: %d", root->name, root->age);

// traverse left tree
BST_Inorder_Search(root->left);

// traverse the right tree
BST_Inorder_Search(root->right);

} // end BST_Preorder_Search

////////////////////////////////////////////////////////////////

void BST_Postorder_Search(TNODE_PTR root)
{
// this searches a BST using the postorder search

// test for NULL
if (!root)
   return;

// traverse left tree
BST_Inorder_Search(root->left);

// traverse the right tree
BST_Inorder_Search(root->right);

// visit the node
printf("\nname: %s, age: %d", root->name, root->age);

} // end BST_Postorder_Search

// MAIN /////////////////////////////////////////////////////////////////

void main(void)
{

int done     = 0, // exit flag
    node_num = 0, // used as node id
    sel      = 0; // used for input

// main event loop
while(!done)
     {
     // display menu
     printf("\n\nBinary Search Tree Demo\n");
     printf("\n1 - Traverse Tree Pre-order.");
     printf("\n2 - Traverse Tree In-order.");
     printf("\n3 - Traverse Tree Post-order.");
     
     printf("\n4 - Insert new node into tree.");
     printf("\n5 - Exit Program.");
     printf("\n\nSelect one please?");

     // get selection
     scanf("%d",&sel);

     // what to do
     switch(sel)
           {
           case 1:
                 {
                 // traverse preorder
                 if (root)
                    BST_Preorder_Search(root);
                 else
                     printf("\nTree empty!\n");
                 }  break;
 
           case 2:
                 {
                 // traverse inorder
                 if (root)
                    BST_Inorder_Search(root);
                 else
                     printf("\nTree empty!\n");
                 }  break;


           case 3:
                 {
                 // traverse posteorder
                 if (root)
                    BST_Postorder_Search(root);
                 else
                     printf("\nTree empty!\n");
                 }  break;


           case 4:
                 {
                 // locals to do the insertion
                 char name[32];
                 int age;
 
                 // get the info
                 printf("\nNew node entry form:\n");
                 printf("\nName?");
                 scanf("%s",name);
                 printf("\nAge?");
                 scanf("%d",&age);

                 // insert the node
                 root = BST_Insert_Node(root, node_num++, age, name); 

                 } break;

           case 5:
                 {
                 done = 1;
                 } break;
 
           default: break;

           } // end switch

     } // end while

} // end main

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品亚洲一区二区三区妖精 | 狠狠色丁香久久婷婷综| 日韩精品自拍偷拍| 国产精品1区2区3区| 国产精品久久久久精k8| 91国偷自产一区二区三区成为亚洲经典| 亚洲一区二区三区自拍| 宅男在线国产精品| 国产一区二区三区四区在线观看| 欧美国产精品中文字幕| 色狠狠av一区二区三区| 亚洲成人先锋电影| 精品国产成人在线影院| 不卡视频一二三四| 亚洲电影激情视频网站| 久久综合狠狠综合久久激情| av午夜精品一区二区三区| 亚洲国产wwwccc36天堂| 精品福利在线导航| 91麻豆国产福利精品| 婷婷中文字幕一区三区| 久久久久久99精品| 色综合色综合色综合| 欧美aaa在线| 国产精品久久久久一区二区三区共 | 人人狠狠综合久久亚洲| 日本一区二区三区视频视频| 欧美在线视频你懂得| 国产一区二区免费视频| 亚洲精品免费在线播放| 日韩欧美一级在线播放| 99久久精品一区二区| 男女性色大片免费观看一区二区| 中文在线免费一区三区高中清不卡| 在线影院国内精品| 国产精品一区专区| 亚洲bt欧美bt精品777| 国产日韩欧美激情| 欧美精品 国产精品| 成人网在线免费视频| 日日夜夜免费精品视频| 国产精品乱码一区二区三区软件| 欧美日韩日日摸| 大桥未久av一区二区三区中文| 午夜伦理一区二区| 国产精品久久久久久亚洲毛片 | av中文字幕一区| 人禽交欧美网站| 亚洲精品免费一二三区| 久久综合久久鬼色中文字| 欧美日韩一区二区三区高清 | 国产日本亚洲高清| 91麻豆精品国产91久久久更新时间| 成人一区二区三区视频| 日韩主播视频在线| 综合久久综合久久| 欧美精品一区二区三区在线播放 | 中文字幕在线观看不卡| 日韩视频在线你懂得| 91黄色在线观看| 成人h精品动漫一区二区三区| 琪琪一区二区三区| 亚洲一区二区三区四区不卡| 国产精品免费观看视频| 精品国产伦一区二区三区观看方式 | 成人动漫一区二区三区| 韩国一区二区三区| 三级亚洲高清视频| 亚洲一区国产视频| 亚洲欧美在线视频观看| 国产视频亚洲色图| 26uuuu精品一区二区| 欧美一区二区视频在线观看2020| 色欧美片视频在线观看在线视频| 国产凹凸在线观看一区二区| 麻豆成人久久精品二区三区红 | 麻豆91精品视频| 午夜欧美视频在线观看| 一个色综合av| 亚洲乱码国产乱码精品精的特点 | 国产欧美精品一区二区三区四区| 欧美变态tickling挠脚心| 91精品久久久久久蜜臀| 欧美日韩国产在线观看| 欧美亚洲高清一区| 色哟哟国产精品免费观看| 成人av电影在线观看| 国产精品亚洲第一| 国产一区二区在线观看视频| 丝袜脚交一区二区| 首页欧美精品中文字幕| 午夜av一区二区三区| 亚洲福中文字幕伊人影院| 亚洲国产综合色| 亚洲一区二区三区激情| 亚洲一区二区三区四区五区中文| 一区二区三区免费| 一区二区久久久久| 亚洲午夜羞羞片| 一级精品视频在线观看宜春院| 一区二区三区在线视频观看58| 亚洲免费在线播放| 夜夜嗨av一区二区三区中文字幕 | 欧美图片一区二区三区| 欧美视频一区二| 欧美色涩在线第一页| 欧美色图12p| 欧美二区三区的天堂| 日日欢夜夜爽一区| 日韩在线卡一卡二| 免费成人结看片| 狠狠色丁香久久婷婷综合_中| 国产九色sp调教91| 成人一区二区三区| 91麻豆福利精品推荐| 在线观看亚洲a| 欧美高清性hdvideosex| 欧美一区午夜视频在线观看| 精品欧美一区二区久久| 国产午夜一区二区三区| 国产精品麻豆欧美日韩ww| 亚洲乱码中文字幕综合| 亚洲chinese男男1069| 蜜臀av一区二区三区| 狠狠v欧美v日韩v亚洲ⅴ| 国产jizzjizz一区二区| 97久久精品人人做人人爽50路| 91精彩视频在线观看| 欧美老女人第四色| 久久一区二区三区四区| 中文字幕一区二区三中文字幕| 亚洲男人天堂av| 丝袜亚洲精品中文字幕一区| 激情六月婷婷综合| 99riav久久精品riav| 欧美日韩亚洲综合在线| 精品欧美乱码久久久久久 | 亚洲色图视频免费播放| 亚洲成a天堂v人片| 国内精品国产成人国产三级粉色 | 亚洲精品在线三区| 国产精品免费看片| 亚洲成人1区2区| 国产精品自拍网站| 一本久久综合亚洲鲁鲁五月天 | 91丝袜高跟美女视频| 欧美另类z0zxhd电影| 久久久久久久久久久久久夜| 亚洲色欲色欲www| 奇米亚洲午夜久久精品| 成人国产精品免费| 欧美夫妻性生活| 国产精品网友自拍| 丝袜脚交一区二区| 成人精品在线视频观看| 精品视频在线免费| 国产亚洲成年网址在线观看| 亚洲激情综合网| 久久成人羞羞网站| 色婷婷综合久久久久中文一区二区| 欧美一区二区三区免费观看视频| 久久精品欧美一区二区三区麻豆| 亚洲自拍另类综合| 国产乱码精品1区2区3区| 色噜噜久久综合| 久久只精品国产| 亚洲一区二区五区| 国产美女在线观看一区| 欧美午夜精品久久久久久孕妇 | 亚洲动漫第一页| 成人一区二区三区中文字幕| 欧美日本一区二区三区四区| 国产农村妇女精品| 欧美一区二区成人| 国产精品欧美久久久久一区二区| 午夜精品久久久| a4yy欧美一区二区三区| 日韩区在线观看| 亚洲自拍偷拍av| 北岛玲一区二区三区四区| 欧美一级片免费看| 洋洋成人永久网站入口| 国产91精品露脸国语对白| 日韩一区二区在线免费观看| 亚洲欧美偷拍三级| 国产精品77777| 日韩欧美一级二级| 亚洲电影一区二区| 95精品视频在线| 久久精品亚洲乱码伦伦中文| 日韩va亚洲va欧美va久久| 日本电影亚洲天堂一区| 亚洲国产精品高清| 狠狠色丁香久久婷婷综合_中| 欧美日韩高清一区二区| 亚洲精品免费电影| 成人av资源网站| 久久久av毛片精品| 免费观看91视频大全| 欧美日韩国产小视频在线观看|