标题:很怪的程序。。。
取消只看楼主
yole
Rank: 1
等 级:新手上路
帖 子:46
专家分:0
注 册:2008-7-10
 问题点数:0 回复次数:1 
很怪的程序。。。
这个东西,在VC6能运行,但是到了vc2008就不能运行了。。。


还用,这个程序,在录入信息的时候有问题,不知道是怎么的。。。
请高手帮忙看看。。
谢谢!

#include <stdio.h>
#include <string.h>
#include <conio.h>
int main(void)
{
    int i;
    char tStr[5];
    struct product
    {
        char no[5];
        char title[20];
        int  price;
    }cd[3];

    printf("=== CD唱片登记程序 ===\n\n");
    for (i=0;i<3;i++)
    {
        printf(" 第%2d 张CD编号:",i+1);
        gets(cd[i].no);
        printf("\tCD名称:");
        gets(cd[i].title);
        printf("\t售  价:");
        scanf("%d",&cd[i].price);
        printf("\n");
    }

    i=0;
    printf("请输入查询的CD编号:");
    do
    {
        gets(tStr);
        if(strcmp(tStr,cd[i].no)==0)
        {
            printf("您要查找的CD详细数据如下:\n");
            printf("1.CD编号:%s\n",cd[i].no);
            printf("2.CD标题:%s\n",cd[i].title);
            printf("3.售  价:%d\n",cd[i].price);
            break;
        }
        i++;
        if(i==3)
            break;

    }while(1);

    return 0;
}
搜索更多相关主题的帖子: include product price title 
2008-07-24 15:25
yole
Rank: 1
等 级:新手上路
帖 子:46
专家分:0
注 册:2008-7-10
得分:0 
晕死,估计又是那个缓冲区的问题。。。
2008-07-24 15:39



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-225081-1-1.html




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

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