锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
#include <iostream>
#include <string.h>
using namespace std;
bool is_equal(char str[]) 

{
int len=strlen(str);
if (len==0)
return false;
else if (len%2==0)
{
int mid=len/2;
bool flag=true;
int i,j;
for(i=0, j=len-1; i<mid; i++,j--)
{
if (str[i]==str[j])
continue;
else
{
flag=false;
break;
}
}
return flag;
}
else
return false;
}
int main()

{
char str[]="helleh";
int return_val;
if (is_equal(str))
return_val=1;
else
return_val=0;
cout<<return_val<<endl;
}
]]>
//鏈夊簭澶氶」寮忓姞娉?/span>
#include <iostream>
using namespace std;
struct Node

{
int coef;
int exp;
Node *next;
};
class MExpression

{
private :
Node *first;
public :
MExpression();
void InsertNode(int coef,int exp);
void DeleteNode(int exp);
void Add(MExpression me);
void PrintAll();
};
MExpression::MExpression()

{
first->next=NULL;
}
void MExpression::InsertNode(int coef,int exp)

{
Node *s=new Node();
Node *p=first;
while(p->next!=NULL)
p=p->next;
s->coef=coef;
s->exp=exp;
s->next=p->next;
p->next=s;
}
void MExpression::DeleteNode(int exp)

{
Node *p=first->next;
Node *q;
q=first;
while(p!=NULL)
{
if (p->exp==exp) break;
q=p;
p=p->next;
}
q->next=p->next;
delete p;
}
void MExpression::Add(MExpression me)

{
int i=0,j=0;
Node *p=first->next;
Node *q=me.first->next;
Node *pp,*qq;
pp=first;
qq=me.first;
while(p&&q)
{
if (p->exp>q->exp)
{
InsertNode(q->coef,q->exp);
q=q->next;
}
else if(p->exp==q->exp)
{
p->coef+=q->coef;
p=p->next;
q=q->next;
}
else
{
p=p->next;
}
}
while(q)
{
InsertNode(q->coef,q->exp);
q=q->next;
}
}
void MExpression::PrintAll()

{
cout<<"=== coef c exp e ==="<<endl;
Node *p=first->next;
while(p!=NULL)

{
cout<<p->coef<<" c "<<p->exp<<" e ";
p=p->next;
}
}
int main()

{
MExpression *me1=new MExpression();
MExpression *me2=new MExpression();
me1->InsertNode(1,1);
me1->InsertNode(2,2);
me1->InsertNode(3,3);
me1->InsertNode(4,4);
me2->InsertNode(1,2);
me2->InsertNode(2,3);
me2->InsertNode(3,4);
me2->InsertNode(4,5);
me1->Add(*me2);
me1->PrintAll();
}
]]>
/**//*
寰幆鍙岄摼琛?br>
*/
#include <iostream>
using namespace std;
struct Node

{
int data;
Node *next;
Node *prior;
};
class CycleDLList

{
private :
Node *first;
public:
CycleDLList();
void InsertNode(int data);
void DeleteNode(int data);
void PrintAll();
};
CycleDLList::CycleDLList()

{
first->prior=first;
first->next=first;
}
void CycleDLList::InsertNode(int data)

{
Node *s=new Node();
s->data=data;
Node *p=first->next;
while(p->next!=first)
{
p=p->next;
}
s->prior=p;
s->next=p->next;
p->next->prior=s;
p->next=s;
}
void CycleDLList::DeleteNode(int data)

{
Node *p=first->next;
Node *q;
while(p!=first)
{
if(p->data==data) break;
q=p;
p=p->next;
}
if (p!=first)
{
q->next=p->next;
p->next->prior=q;
delete p;
}
}
void CycleDLList:: PrintAll()

{
Node *p=first->next;
Node *q=first->prior;
cout<<"p=p->next"<<endl;
while(p!=first)

{
cout<<p->data<<" ";
p=p->next;
}
cout<<endl;
cout<<"q=q->prior"<<endl;
while(q!=first)

{
cout<<q->data<<" ";
q=q->prior;
}
}
int main()

{
CycleDLList *cd=new CycleDLList();
cd->InsertNode(5);
cd->InsertNode(4);
cd->InsertNode(3);
cd->InsertNode(2);
cd->PrintAll();
cd->DeleteNode(2);
cd->PrintAll();

}
]]>
#include <iostream>
2
using namespace std;
3
4
struct Node
5
{
6
int data;
7
Node *next;
8
};
9
class CycleLinkList
10
{
11
private :
12
Node *first;
13
public :
14
CycleLinkList();
15
void InsertNode(int data);
16
void DeleteNode(int data);
17
void PrintAll();
18
};
19
20
CycleLinkList:: CycleLinkList()
21
{
22
first=first->next;
23
}
24
void CycleLinkList::InsertNode(int data)
25
{
26
Node *s=new Node();
27
s->data=data;
28
Node *p=first;
29
if (p->next==first)
30
{
31
s->next=first->next;
32
first->next=s;
33
}
34
else
35
{
36
while(p->next!=first) p=p->next;
37
s->next=p->next;
38
p->next=s;
39
}
40
}
41
42
void CycleLinkList::DeleteNode(int data)
43
{
44
Node *p=first->next;
45
Node *q=first->next;
46
while(p!=first)
47
{
48
if (p->data==data) break;
49
else
50
{
51
q=p;
52
p=p->next;
53
}
54
}
55
q->next=p->next;
56
delete p;
57
}
58
void CycleLinkList:: PrintAll()
59
{
60
Node *p=first->next;
61
62
while(p!=first)
63
{
64
cout<<p->data<<" ";
65
p=p->next;
66
}
67
}
68
int main()
69
{
70
CycleLinkList *cl=new CycleLinkList();
71
cl->InsertNode(3);
72
cl->InsertNode(4);
73
cl->InsertNode(5);
74
cl->InsertNode(6);
75
cl->PrintAll();
76
cl->DeleteNode(4);
77
cl->PrintAll();
78
}
]]>
public class SortDemo
{
private int[] sortArray;

public SortDemo()
{
sortArray=new int[8];
}

public void swap(int i,int j)
{
int t=sortArray[i];
sortArray[i]=sortArray[j];
sortArray[j]=t;
}

public void insertArray(int pos,int val)
{
sortArray[pos]=val;
}

public void selectSort()
{
int t,tt;
for(int j=0;j<sortArray.length-1;j++)
{

for(int i=j+1;i<sortArray.length;i++)
{
if(sortArray[i]<sortArray[j]) swap(i,j);
}
}
}


public void bubbleSort()
{
int exchange=sortArray.length;
int bound;
while(exchange!=0)
{
bound=exchange-1;
exchange=0;
for(int i=0;i<bound;i++)
{
if(sortArray[i]>sortArray[i+1])
{
swap(i,i+1);
exchange=i+1;
}
}
}
}

public void insertSort()
{
for(int i=1;i<sortArray.length;i++)
{
int temp=sortArray[i];
int j=i;
while(j>0&&temp<sortArray[j-1])
{
sortArray[j]=sortArray[j-1];
j--;
}
sortArray[j]=temp;
}
}

public void showResult()
{
for(int i =0;i<sortArray.length;i++)
System.out.print(sortArray[i]+" ");
System.out.println("");
}

public static void main(String[] args)
{
SortDemo so=new SortDemo();
so.insertArray(0,2);
so.insertArray(1,23);
so.insertArray(2,22);
so.insertArray(3,12);
so.insertArray(4,42);
so.insertArray(5,32);
so.insertArray(6,62);
so.insertArray(7,52);
so.showResult();
so.selectSort();
so.showResult();
so.bubbleSort();
so.showResult();
so.insertSort();
so.showResult();
}
}
]]>
dim conn,Strconn
Set conn = Server.CreateObject("ADODB.Connection")
Strconn="DRIVER={Microsoft Access Driver (*.mdb)};"
Strconn=Strconn &"DBQ=" & Server.MapPath ("baoming.mdb")
conn.Open Strconn
import javax.swing.JOptionPane;

public class windowss
{
public static void main(String[] args)
{
String aa;
aa=JOptionPane.showInputDialog("please enter a number:");
String bb;
bb=JOptionPane.showInputDialog("plese enter a number:");
int a;
a=Integer.parseInt(aa)+Integer.parseInt(bb);;
String outstr;
JOptionPane.showMessageDialog(null,"the result is:"+a,"try",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}bOpenFileDialog
Set to TRUE to construct a File Open dialog box or FALSE to construct a File Save As dialog box.
// CFileDialog dlg(false,"TXT",NULL,NULL,"Text file(*.txt)|*.TXT|",NULL);
璇誨彇鏂囦歡錛?/p>
virtual UINT Read( void* lpBuf,
UINT nCount );
throw( CFileException
);
lpbuf緙撳啿鍖烘寚閽?/strong>
nCount瑕佽鐨勯暱搴?/strong>
/*
int len=file.GetLength(); char *buffer=new char[len+1]; if(!buffer) { MessageBox("Allocating fail"); } else { try { file.Read(buffer,len); } catch(CFileException *e) { MessageBox("Reading file error"); file.Close(); e->Delete(); return ; } */ 鑾峰彇褰撳墠鏃墮棿錛?/strong> current_time=CTime::GetCurrentTime(); str_year.Format("%d",current_time.GetYear()); str_month.Format("%d",current_time.GetMonth()); str_day.Format("%d",current_time.GetDay()); CString m_date=str_year+"-"+str_month+"-"+str_day;
CDC memDC; //瀹氫箟璁懼鐜綾誨璞?br> memDC.CreateCompatibleDC (pDC); //鍒涘緩鍐呭瓨璁懼鐜
pbm=memDC.SelectObject (&bm); //灝嗕綅鍥鵑夊叆璁懼鐜
//灝嗗唴瀛樿澶囩幆澧冪殑浣嶅浘浼犺緭鍒拌澶囩幆澧?br> pDC->BitBlt (0,0,bmMetric.bmWidth ,bmMetric.bmHeight ,&memDC,0,0,SRCCOPY);
memDC.SelectObject (pbm); //鎭㈠鍘熻澶囩幆澧冨璞?br> bm.DeleteObject ();
memDC.DeleteDC();