| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 924 人关注过本帖
标题:c语言程序运行不了?来人啊!
取消只看楼主 加入收藏
h153565666
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-4-6
结帖率:66.67%
收藏
已结贴  问题点数:10 回复次数:2 
c语言程序运行不了?来人啊!
看c primer 有个程序
#include<stdio.h>
int main(void)
{
    unsigned width,precision;
        int number=256;
        double weight=242.5;
        printf("what field width?\n");
        scanf("%d,&width");
        printf("the number is:%*d: \n",width,number);
        printf("now enter a width and a precision: \n");
        scanf("%d %d",&width,&precision);
        printf("weight=&*.*f\n",width,precision,weight);
        return 0;
}
我在vs2010上运行的时候出现了第一排“what field width?”但是我随便输入一个数字,然后vs2010就崩溃了,哪位好心人能帮下
搜索更多相关主题的帖子: return c语言 
2011-04-08 13:48
h153565666
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-4-6
收藏
得分:0 
回复 2楼 ansic
谢了  你还能跟我讲下原理吗  书上的讲的不详细  每一步是什么意思
2011-04-08 14:02
h153565666
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-4-6
收藏
得分:0 
回复 7楼 ansic
int main(void)
{
    unsigned width,precision;
        int number=256;
        double weight=242.5;
        printf("what field width?\n");
        scanf("%d",&width);
        printf("the number is:%*d: \n",width,number);  【%*d是什么意思,通常%d这种类型的不都是取一个值吗?怎么后面有2个:一个width和number,实际运行number is:256。搞不懂
        printf("now enter a width and a precision: \n");
        scanf("%d %d",&width,&precision);
        printf("weight=%*.*f\n",width,precision,weight);【首先%*.*f就不懂,然后后面跟3个可以调用的值也完全搞不懂】
        return 0;
}
我昨天才学的C语言,没点基础,不好意思了。
2011-04-08 17:04
快速回复:c语言程序运行不了?来人啊!
数据加载中...
 
   



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

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