c language commonly used method

Function name: POW 
Function: exponential function (x to the power of y) 
Usage: double pow (double x, double  y);
The procedure of Example: 

#include <math.h> 
#include <stdio.h> 

int main (void) 

   Double X = 2.0, Y = 3.0; 

   the printf ( "% LF raised to% LF IS% LF \ n-", X, Y, POW (X, Y)); 
   return 0; 

  

function name: pow10 
function: exponential function ( 10 ^ p) 
Usage: double pow10 (int p); 
procedure of Example: 

#include <math.h> 
#include <stdio.h> 

int main (void) 

   Double p = 3.0; 

   the printf ( "% Ten raised to IS% LF LF \ n-", P, pow10 (P)); 
   return 0; 
}

Hair string and related parties

 

    strlen () display string length;

    strlwr () function usage and strupr () function calls are passed directly to the string, the role of strlwr () function is to convert the string argument into lowercase. Strupr action () function is to convert the string argument to uppercase.

   the puts () and gets () and the specific output of the input string.

#include <stdio.h>
int main(){//字符的输入输出
    char str1[30] = {0};
    char str2[30] = {0};
    char str3[30] = {0};

    //gets() 用法
    printf("Input a string: ");
    gets(str1);

    //scanf() 用法
    printf("Input a string: ");
    scanf("%s", str2);
    scanf("%s", str3);
   
    printf("\nstr1: %s\n", str1);
    printf("str2: %s\n", str2);
   	puts(str3);

    return 0;
}

 

Published 34 original articles · won praise 6 · views 4778

Guess you like

Origin blog.csdn.net/qq_42712280/article/details/93594231