标题:用vs2017一个书上的例子不能运行
取消只看楼主
wrh986123958
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2017-10-15
结帖率:0
已结贴  问题点数:20 回复次数:0 
用vs2017一个书上的例子不能运行
#include <stdio.h>
#include <string.h>
#define DENSITY 62.4
int main()
{
    float weight, volume;
    int size, letters;
    char name[40];

    printf("Hi!What's your first name?\n");
    scanf_s("%s", name);
    printf("%s,what's your weight in pounds?\n", name);
    scanf_s("%f", &weight);
    size = sizeof name;
    letters = strlen(name);
    volume = weight / DENSITY;
    printf("Well,%s,your volume is %2.2f cubic feet.\n",
        name, volume);
    printf("Also,your first name has %d letters,\n",
        letters);
    printf("and we have %d bytes to store it.\n", size);
    return 0;

}
运行后输入名字再回车,就开始出现问题了
搜索更多相关主题的帖子: vs2017 例子 运行 name printf 
2017-10-15 21:58



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




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

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