天天看點

周總結<3>

經過了一周的學習,我們在html以及C語言方面又有的新的知識點的學習,包括計算機導論也學會了路由器的設定。

html 滑鼠事件
C 二叉樹的周遊代碼
計算機導論 路由器的設定

Html案例:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>無标題文檔</title>

</head>

<script type="text/javascript">

function mouseIn()

{

document.bgColor="red";

}

function mouseOut()

document.bgColor="blue";

var x=0,y=0;

function move()

x=window.event.x;

y=window.event.y;

window.status="X: "+x+" "+"Y: "+y+" ";

document.onmousemove=move;

function keypree()

switch(window.event.keyCode)

case 119: document.bgColor="blue";

break;

case 97: document.bgColor="yellow";

document.onkeypress=keypree;

</script>

<body bg>

<input type="button" value="改變背景顔色" onmousedown="mouseIn()" onmouseup="mouseOut()" />

</body>

</html>

C語言案例:

#include "stdafx.h"

#include "stdio.h"

#include "stdlib.h"

typedef char DataType;

typedef struct Node{

DataType data;

struct Node *LChild, *RChild;

}*BiTree;

/*先序周遊*/

void PreOrder(BiTree root)

if ( root!=NULL )  

printf("%c", root->data);//通路根結點

PreOrder(root->LChild) ;

PreOrder(root->RChild) ;

/*中序周遊*/

void InOrder(BiTree root)

InOrder(root->LChild) ;

InOrder(root->RChild) ;

/*後序周遊*/

void PostOrder(BiTree root)

PostOrder(root->LChild) ;

PostOrder(root->RChild) ;

printf("%c", root->data);

int main(int argc, char* argv[])

printf("303 柳曉雅 周遊\n");

int i;

BiTree t[10];

t[1]=(BiTree)malloc(sizeof(*t[0]));

t[2]=(BiTree)malloc(sizeof(*t[0]));

t[1]->data='A';

t[2]->data='B';

for (i=3;i<=9;i++)

t[i]=(BiTree)malloc(sizeof(*t[0]));

t[i]->data='A'+i;

t[i]->RChild=NULL;

t[i]->LChild=NULL;

t[1]->LChild=t[2]; t[1]->RChild=t[3];

t[2]->LChild=t[4]; t[2]->RChild=t[5];

t[5]->LChild=t[8]; t[5]->RChild=t[9];

t[3]->LChild=t[6]; t[3]->RChild=t[7];

printf("先序周遊:");

PreOrder(t[1]);

printf("\n");

printf("中序周遊:");

InOrder(t[1]);

printf("後序周遊:");

PostOrder(t[1]);

return 0;