c语言程序运行错误?
#include<stdio.h>#include<string.h>#defineDENSITY62.4;intmain(){floatweight,volume;in...
#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 nane?\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 ie.\n", size);
return 0;
}在vs2017运行这个程序以后,输入name以后程序就终止了。请问哪里有错呢? 展开
#include<string.h>
#define DENSITY 62.4;
int main()
{
float weight, volume;
int size, letters;
char name[40];
printf("hi!what's your first nane?\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 ie.\n", size);
return 0;
}在vs2017运行这个程序以后,输入name以后程序就终止了。请问哪里有错呢? 展开
1个回答
意法半导体(中国)投资有限公司
2023-06-12 广告
2023-06-12 广告
单片机,即单片微控制器,也称为单片微型计算机,是将中央处理器(CPU)、存储器(ROM,RAM)、输入/输出接口和其他功能部件集成在一块 在一个小块的集成电路上,从而实现对整个电路或系统的数字式控制。单片机不是完成某一个逻辑功能的芯片,而是...
点击进入详情页
本回答由意法半导体(中国)投资有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询