| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 556 人关注过本帖
标题:求大神帮忙,,可怜一下大一的(我自己写的课设出问题了)
只看楼主 加入收藏
chaoge他爹
Rank: 2
等 级:论坛游民
帖 子:26
专家分:24
注 册:2012-11-9
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:15 
求大神帮忙,,可怜一下大一的(我自己写的课设出问题了)
我没有将全部代码写上,,,,你们懂得,,,嘿嘿
我的问题是在进入creat函数时出现的
当输入:
1
1
1
1
1
时没有问题,当输入:
1

13829292929
2929292929
2929292929@
时就出现问题了

跪求原因
2012-12-28 11:13
chaoge他爹
Rank: 2
等 级:论坛游民
帖 子:26
专家分:24
注 册:2012-11-9
收藏
得分:0 
代码如下:
#include<stdio.h>
#include<windows.h>
#include<stdlib.h>
#include<string.h>
#define LEN sizeof(struct xinxi)
int n;
struct xinxi
{
    char number[5];
    char name[15];
    char telephone[11];
    char QQnumber[10];
    char email[30];
    struct xinxi *next;
};

struct xinxi *head;
struct xinxi *p1,*p2,*p;
struct xinxi ch[1000000];
char p_mulu()                                                                       //目录界面
{

    printf("*******************************************************************************\n");
    printf("*                                                                             *\n");
    printf("*                                                                             *\n");
    printf("*                  先生/女士----------您好                                    *\n");
    printf("*                                                                             *\n");
    printf("*     欢迎使用本通讯录系统。由于本人能力有限,对您造成的不便之处,请谅解。    *\n");
    printf("*                                                                             *\n");
    printf("*                                                                             *\n");
    printf("*                                                                             *\n");
    printf("*        █ 如若您想添加联系人信息,请按1;                                    *\n");
    printf("*                                                                             *\n");
    printf("*        █ 如若您想查看已有联系人信息 ,请按2;                               *\n");
    printf("*                                                                             *\n");
    printf("*        █ 如若您想搜索联系人信息,请按3;                                    *\n");
    printf("*                                                                             *\n");
    printf("*        █ 如若您想修改联系人信息,请按4;                                    *\n");
    printf("*                                                                             *\n");
    printf("*        █ 退出本程序,请按5;                                                *\n");
    printf("*                                                                             *\n");
    printf("*                                                                             *\n");
    printf("*                                                                             *\n");
    printf("*                                                                             *\n");
    printf("*                                                                             *\n");
    printf("*******************************************************************************\n");
    char a;
    printf("请输入您的选择:");
    scanf("%c",&a);
    system("cls");
    return (a);
}
void creat(void)
{
    n=0;
    //char b;
    FILE * fp;
    /*printf("*******************************************************************************\n");
    printf("*                                                                             *\n");
    printf("*                                                                             *\n");
    printf("*                            是否储存已有文件?                               *\n");
    printf("*                                                                             *\n");
    printf("*                                  (Y/N)                                      *\n");
    printf("*                                                                             *\n");
    printf("*                                                                             *\n");
    printf("*                                                                             *\n");
    printf("*                                                                             *\n");
    printf("*******************************************************************************\n");
    printf("%c请输入您的选择%c:",1,1);
    for(scanf("%c",&b);b=='Y'||b=='y'||b=='N'||b=='n';scanf("%c",&b))
    {
    if(b=='Y'||b=='a')
    fp=fopen("a.txt","r");
    else if(b=='N'||b=='n')
    fp=fopen("a.txt","w");
    else  p_jinggao();
    system("cls");
    getchar();
}*/
    fp=fopen("a.txt","a+");
    char a;
    head=(struct xinxi*)malloc(LEN);
    p1=(struct xinxi*)malloc(LEN);
    head->next=p1;
    p1->next = NULL;
    while(1)
    {
        p2=(struct xinxi*)malloc(LEN);
        printf("*******************************************************************************\n");
        printf("*                                                                             *\n");
        printf("*         请在下面添加联系人信息                                              *\n");
        printf("*                                                                             *\n");
        printf("*         联系人编号:                                                         *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*******************************************************************************\n");
        printf("请输入联系人编号:");
        scanf("%s",p1->number);
        fprintf(fp,"%s ",p1->number);
        system("cls");
        printf("*******************************************************************************\n");
        printf("*                                                                             *\n");
        printf("*         请在下面添加联系人信息                                              *\n");
        printf("*                                                                             *\n");
        printf("*         联系人编号:%-15s                                          *\n",p1->number);
        printf("*         联系人姓名:                                                         *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*******************************************************************************\n");
        printf("请输入联系人姓名:");
        scanf("%s",p1->name);
        fprintf(fp,"%s ",p1->name);
        system("cls");
        printf("*******************************************************************************\n");
        printf("*                                                                             *\n");
        printf("*         请在下面添加联系人信息                                              *\n");
        printf("*                                                                             *\n");
        printf("*         联系人编号:%-15s                                          *\n",p1->number);
        printf("*         联系人姓名:%-10s                                               *\n",p1->name);
        printf("*         联系人手机号码:                                                     *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*******************************************************************************\n");
        printf("请输入联系人手机号码:");
        scanf("%s",p1->telephone);
        fprintf(fp,"%s ",p1->telephone);
        system("cls");
        printf("*******************************************************************************\n");
        printf("*                                                                             *\n");
        printf("*         请在下面添加联系人信息                                              *\n");
        printf("*                                                                             *\n");
        printf("*         联系人编号:%-15s                                          *\n",p1->number);
        printf("*         联系人姓名:%-10s                                               *\n",p1->name);
        printf("*         联系人手机号码:%-11s                                          *\n",p1->telephone);
        printf("*         联系人QQ号码:                                                       *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*******************************************************************************\n");
        printf("请输入联系人QQ号码:");
        scanf("%s",p1->QQnumber);
        fprintf(fp,"%s ",p1->QQnumber);
        system("cls");
        printf("*******************************************************************************\n");
        printf("*                                                                             *\n");
        printf("*         请在下面添加联系人信息                                              *\n");
        printf("*                                                                             *\n");
        printf("*         联系人编号:%-15s                                          *\n",p1->number);
        printf("*         联系人姓名:%-10s                                               *\n",p1->name);
        printf("*         联系人手机号码:%-11s                                          *\n",p1->telephone);
        printf("*         联系人QQ号码:%-10s                                             *\n",p1->QQnumber);
        printf("*         联系人邮箱:                                                         *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*******************************************************************************\n");
        printf("请输入联系人邮箱:");
        scanf("%s",p1->email);
        fprintf(fp,"%s\n",p1->email);
        system("cls");
        printf("*******************************************************************************\n");
        printf("*                                                                             *\n");
        printf("*         请在下面添加联系人信息                                              *\n");
        printf("*                                                                             *\n");
        printf("*         联系人编号:%-15s                                          *\n",p1->number);
        printf("*         联系人姓名:%-10s                                               *\n",p1->name);
        printf("*         联系人手机号码:%-11s                                          *\n",p1->telephone);
        printf("*         联系人QQ号码:%-10s                                             *\n",p1->QQnumber);
        printf("*         联系人邮箱:%-20s                                     *\n",p1->email);
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*         该联系人信息输入成功                                                *\n");
        printf("*         继续输入请按'y'                                                     *\n");
        printf("*         停止输入请按'0'                                                     *\n");
        printf("*                                                                             *\n");
        printf("*                                                                             *\n");
        printf("*******************************************************************************\n");
        p1->next = p2;
        p2->next=NULL;
        p1=p2;
        printf("%c请输入您的选择%c:",1,1);
        getchar();
        scanf("%c",&a);
        if(a=='0')break;
        system("cls");
    }
    fclose(fp);

}
int main ()                                                                            //主函数
{
//    p_huanying();                                                                  //欢迎界面
    {
        for(;;)
        {
            char o;
            o=p_mulu();                                                              //目录界面
            switch(o)
            {
            case'1':creat();break;
            //case'2':chakan();break;
            //case'3':sosuo();break;
                //case'4':xiugai;break;
            case'5':break;
            //default:p_jinggao();break;
            }
            if (o=='5')
                break;
        }
    }
//    p_jieshu();                                                                    //结束界面
    return 0;
}
2012-12-28 11:14
chaoge他爹
Rank: 2
等 级:论坛游民
帖 子:26
专家分:24
注 册:2012-11-9
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册
2012-12-28 11:15
chaoge他爹
Rank: 2
等 级:论坛游民
帖 子:26
专家分:24
注 册:2012-11-9
收藏
得分:0 
有没有人帮帮忙啊
2012-12-28 11:34
chaoge他爹
Rank: 2
等 级:论坛游民
帖 子:26
专家分:24
注 册:2012-11-9
收藏
得分:0 
2012-12-28 12:37
麦香
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:65
专家分:163
注 册:2011-10-18
收藏
得分:4 
为什么我编译出现这么多错误
图片附件: 游客没有浏览图片的权限,请 登录注册


你们要进窄门,因为引向灭亡的门是宽的,路是大的,进去的人也多。
2012-12-28 12:47
chaoge他爹
Rank: 2
等 级:论坛游民
帖 子:26
专家分:24
注 册:2012-11-9
收藏
得分:0 
我用的是VC++6.0,,,,,什么问题也没有啊,,,
2012-12-28 15:20
chaoge他爹
Rank: 2
等 级:论坛游民
帖 子:26
专家分:24
注 册:2012-11-9
收藏
得分:0 
你用的是什么编译器,,,,,,
2012-12-28 15:21
qwhw0827
Rank: 2
等 级:论坛游民
帖 子:34
专家分:15
注 册:2011-11-28
收藏
得分:0 
二楼的很强大。定下。。。新手学习了。小手一抖,经验到手。哈哈哈
2012-12-28 15:42
yaobao
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:4
帖 子:1854
专家分:4121
注 册:2012-10-25
收藏
得分:2 
VS啊,报了一整页的错啊

认认真真的学习,踏踏实实的走路:戒骄戒躁!!!
2012-12-28 15:42
快速回复:求大神帮忙,,可怜一下大一的(我自己写的课设出问题了)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.105991 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved