#include
# include
# 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 ", & amp; Weight);
Size=sizeof the name;
Letters=strlen (name);
Volume=weight/DENSITY;
Printf (" well, % s, your volume is % 2.2 f cubic feet. \ n ", the name, volume).
Printf (" your first name from the % d letters, \ n ", letters);
Printf (" and we have % d bytes to store it. \ n ", size);
return 0;
CodePudding user response:
When scanf_s () to receive the stringWant to have the parameters of the buffer boundary value
Scanf_s instead (" % s ", name, sizeof (name));
CodePudding user response:
The compiler has to point out problems, scanf_s for name is missing, suggest the use of the building Lord learn scanf_sscanf_s (" % s ", name, 40).the length of the name is 40