mydjm

 

2012年5月10日

链表插入操作~

摘要: 1 #include <iostream> 2 using namespace std; 3 4 5 typedef struct node 6 { 7 int data; 8 struct node* next; 9 }Node;//节点结构体10 11 12 Node* create(int n)//初始化头指针为空~13 {14 Node* head=(Node*)(malloc(sizeof(Node)));15 head->next=NULL;16 head->data=n;17 return head;18 }19 20 voi... 阅读全文

posted @ 2012-05-10 10:33 mydjm 阅读(420) 评论(0) 推荐(0) 编辑

字符串转换为整数(大数会用到滴)

摘要: 1 #include <iostream> 2 using namespace std; 3 4 void main() 5 { 6 int num=0,i=0; 7 char c[20],temp[20]; 8 cout<<"请输入字符串:"<<endl; 9 cin>>c;10 strcpy(temp,c);11 while (temp[i]!='\0')12 {13 num=num*10+temp[i]-'0';14 i++;15 }16 cout<<"整数为:&qu 阅读全文

posted @ 2012-05-10 10:26 mydjm 阅读(379) 评论(0) 推荐(0) 编辑

整数转换成字符串(大数会用到滴)

摘要: 1 #include <iostream> 2 #include <complex> 3 using namespace std; 4 5 void main() 6 { 7 int temp,num,i=0; 8 char c[20]; 9 cout<<"请输入整数"<<endl;10 cin>>num;11 temp=num;12 13 while(temp!=0)14 {15 c[i]=temp%10+'0';16 i++;17 temp/=10;18 }19 ... 阅读全文

posted @ 2012-05-10 10:15 mydjm 阅读(341) 评论(0) 推荐(0) 编辑

导航