求大神快点帮忙,急。。。。。

来源:互联网  时间:2016/8/27 5:10:17

关于网友提出的“ 求大神快点帮忙,急。。。。。”问题疑问,本网通过在网上对“ 求大神快点帮忙,急。。。。。”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题: 求大神快点帮忙,急。。。。。
描述:

#include 
#include 
#include 
using namespace std;
typedef struct{
    int key;
    string  value;   
}DicElement;
typedef struct{
    int MAXNUM;
    int n;
    DicElement *element;
}SeqDictionary;
typedef SeqDictionary*PSeqDictionary;
PSeqDictionary createEmptyDictionary_seq(int m ) {
//分配空间
    PSeqDictionary p= (PSeqDictionary)malloc(sizeof(SeqDictionary));
   if (p!=NULL){
     p->element= (DicElement*)malloc(sizeof(DicElement)*m);
   if (p->element){
       p->MAXNUM=m;
       p->n=m;
       return (p);
      }
    }
     printf("Out of space!!\n"); /* 存储分配失败 */
    return NULL;
}
int main()
{   int zz;
    ifstream fin("list.txt");//打开文件
        PSeqDictionary stu;
        stu=createEmptyDictionary_seq(80);
for(int i=0;i<80;i++){
        fin>>zz;      //这里zz只是个酱油而已
        fin>>stu->element[i].key;                   
//从这里往下就运行出错显示停止工作了,为什么??????????????????????????????????
        fin>>stu->element[i].value;
      cout<<>element[i].key<<"    "<element[i].value<<>
    }
fin.close();
return 0;
}
其中 list这个文件形式是如下:(共80行)
1  1000010314  潘楚中   
2  1000010524  董比立  
3  1000010551  田博  
4  1580133518  王澍  
5  00604155    陈牧原  
……


解决方案1:

你的list文件的汉字的编码是utf-8的吗?

解决方案2:

崩溃的时候在弹出的对话框按相应按钮进入调试,按Alt+7键查看Call Stack即“调用堆栈”里面从上到下列出的对应从里层到外层的函数调用历史。双击某一行可将光标定位到此次调用的源代码或汇编指令处,看不懂时双击下一行,直到能看懂为止。

解决方案3:

一半代码是C,一半代码是C++,看得想哭
要么把malloc换成new,要么把string换成char[]

上一篇Linux qt用sdl控件写的播放器不直接显示
下一篇c++ 如何获取麦克风收到的声音的音量 根据声音绘制进度条
明星图片
相关文章
《 求大神快点帮忙,急。。。。。》由码蚁之家搜集整理于网络,
联系邮箱:mxgf168#qq.com(#改为@)