Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Question 1:gets[str]] can be used to input integer real variables? Where's Putt?
Question 1:gets[str]] can be used to input integer real variables? Where's Putt?
# include & ltstdio.h & gt

int main()

{

char str[ 10]= { NULL };

int n;

Floating m;

gets(str); //gets is a string input, and integers and floating points cannot be entered.

//However, it can be formatted into the corresponding value of a variable through the sscanf function.

sscanf(str," %d ",& ampn); //Formats a string as a variable by shaping.

printf("%d\n ",n);

sscanf(str," %f ",& ampm); //Format the string as a floating-point form of a variable.

printf("%f\n ",m);

Sell (str);

Returns 0; //You can just enter an integer or a numerical value with a decimal point to test, such as 12 438+02.

}

//Write an example for your reference. ...