Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What is the method of converting C language characters into plastic characters?
What is the method of converting C language characters into plastic characters?
Two methods: one is to use the atoi function. The second is to use print format.

Atoi function: function prototype: Intatoi (constchar * nptr);

Function: Converts a string to an integer.

Parameter nptr string. If the first non-blank character exists, it is a number or symbol, and it will start type conversion. After that, when a non-numeric character (including the terminator \0) is detected, it will stop the conversion and return an integer. Otherwise, zero is returned.

Additional code: #include? " stdio.h"#include? " stdlib.h"#include? "conio.h" is invalid? main(){char? str[ 1024]? =? {0}; int? IntergerPrintf ("Enter a number: \ n"); scanf("%s ",str); sscanf(str," %d ",& ampinter ger); Printf ("Convert to plastic: %d\n",? inter ger); getch(); }