Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Acquisition can be reshaped.
Acquisition can be reshaped.
# include & ltstdio.h & gt

# include & ltmath.h & gt

Void output (char *s, int n); //Define the output function

int main()

{

String [30];

Printf ("Please enter a string:"); //Enter the string

gets(str);

Output (str, 30); //Call the output function

Returns 0;

}

//output function

Void output (char *s, int n)

{

char * I;

int j,k,t,m,temp[ 10],num

Double sum, a [30];

for (i=s,num=0,j=0,m = 0; I<s+n; i++)

if(* I & gt; = ' 0 ' & amp& amp* i & lt='9') num= 1,temp[j++]=(int)(* I-' 0 ');

else if (num){

for (num=0,k=0,sum=0,t = j- 1; k & ltj; sum+=temp[k]*pow( 10,t),t -,k++);

a[m++]=sum,j = 0;

}

For (j=0, there are %d numbers in the printf ("string. \ nResult:', m); j & ltm; printf("%.0f ",a[j++]);

printf(" \ n ");

}

Extended data:

Usage of printf () function:

The calling format of the printf () function is: printf(" &;; lt; Format string &; gt; ”,& amplt; Parameter table &; gt; )。

The formatted string consists of two parts: one part is normal characters and will be output as it is; The other part is to format the specified characters, starting with "%"followed by one or several specified characters, which is used to determine the format of the output content.

Parameter list is a series of parameters to be output, and its number must be as much as the number of output parameters described in the formatted string. The parameters are separated by ",",and the order is one-to-one, otherwise unexpected errors will occur.

For example:

int a = 6789

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

The output result is a=6789.