![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
wxiaojia
这个作者很懒,什么都没留下…
展开
-
文件的读取和写入c++
文件的读取,S是一个学生链表 , typedef struct Student { string no; //学号 string name; //姓名 string cla; //班级 string sex; //性别 string phone; /手机号码 string sele; //选修课程 }Student; typ原创 2017-05-02 14:10:19 · 566 阅读 · 0 评论 -
分割字符数组 c++
c++中,将一个大的字符数组分割为小的字符数组: #include #include using namespace std; void main() {char str[] = "1------小+-----15软件10班------男------15335691------"; /*待分隔的原字符串*/ char seg[] = "------";原创 2017-05-02 14:20:11 · 1208 阅读 · 0 评论 -
0/1背包问题 c++
#include #define M 20 using namespace std; int w[M],p[M],bestx[M],x[M]; //x[]暂存 int n,bestP=0; //表示当前背包获得的最大价值 int C; //将单位重量的物品按降序排 void sort(int n){ int flag,index; for(int i=1;i index=i;原创 2017-05-24 21:10:23 · 729 阅读 · 0 评论 -
哈夫曼数 c++
#include #include using namespace std; #define M 100 /*weight:该结点的权值。 lchild:该结点的左孩子结点在数组中的下标。 rchild:该结点的右孩子结点在数组中的下标。 parent:该结点的双亲结点在数组中的下标。*/ struct element { double weight; int lchil原创 2017-05-16 22:50:26 · 285 阅读 · 0 评论 -
回溯法求和 算法设计
#include using namespace std; #define M 100 void main(){ int x[M],Y[M]; int n,y,sum=0,k=0; cout<<"请输入数组x的个数:"; cin>>n; for(int i=0;i<n;i++){ cout<<"x"<<(i+1)<<": "; cin>>x[i]; }原创 2017-06-19 19:01:43 · 486 阅读 · 0 评论