周总结
在这一周我打了一些代码,虽然在打代码的而过程中晕倒了一些问题但是我还是和同学们一起解决了虽然不是很长但是也是我进过女里写出来的.
void StackPop(Stack *S,ElemType *elem)
{
if(StackEmpty(*S)) {printf("%d","Stack is full");exit(0);}
else *elem=S->top--;
}
void GetTop(Stack S,ElemType *elem)
{
if(StackEmpty(S)) {printf("%d","Stack is full");exit(0);}
else *elem=S.top;
}
void Push(Stack *S, ElemType elem)
{ p=( StackNode *)malloc(sizeof(StackNode));
if(!p) exit(OVERFLOW);
else
{p->data=elem;
p->next=S->top;
S->top=p;}
}
void EnQueue(QUEUE *Q,Elemtype elem)
{ s=(LINKLIST*)malloc(sizeof(LINKLIST));
if(!s) exit(ERROR);
s->elem=elem;
s->next=NULL;
Q->rear->next=s;
Q->rear=s;
}
在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>
<script type="text/javascript">
var currImgNo;
var lastImgNo;
var myArray=new Array(13);
function mySort()
{
return Math.random()>.5;
}
function init(row, col)
{
//0--12
var n=(row*col)*2;
for(var k=0;k<n;k++)
{
myArray[k]=( Math.round( Math.random()*18 ));
myArray[k+n]=myArray[k];
}
myArray.sort(mySort);
var str='<table name="myT" border="1" width="300" height="300">';
for(var i=1;i<=row;i++)
{
str+="<tr>";
for(var j=0;j<col;j++)
{
str+="<td onclick='judge("+ ((i-1)*col +j )+");'>"
str +="<img id='img_"+ ((i-1)*col +j )+"' src='photo/image0.gif'/>"
str+="</td>";
}
str+="</tr>";
}
str+= "</table>"
// i=1 j=1---3 1 2 3 (i-1)*3+j
//i=2 4 5 6
//document.write(str);
document.getElementById("mt").innerHTML=str;
}
function createTable()
{
var row=document.getElementById("t1").value;
var col=document.getElementById("t2").value;
init(row,col);
}
function judge(temp)
{
/*lastImgNo=currImgNo;
currImgNo=temp;*/
//temp 表格单元格编号 1---12
var currImg=document.getElementById("img_"+temp);
currImg.src="photo/image"+myArray[temp]+".gif";
/* if(currImgNo>=0&&lastImgNo>=0)
{
if(myArray[currImgNo]==myArray[lastImgNo])
{ alert("匹配成功");
currImgNo=lastImgNO=-1;
}
else
{ var lastImg= document.getElementById("img_"+lastImgNO);
lastImg.src="photo/image0.gif";
}
}*/
}
</script>
</head>
<body>
<div id="mt">test</div>
<input type="text" value="3" id="t1"/>
<input type="text" value="4" id="t2"/>
<input type="button" value="生产表格" onClick="createTable();"/>
</body>
</html>
虽然这些代码量还远远不够但是我还是会努力学习的.