第二种:
/*****************************************************************
** HighlightCodeV3.0 software by yzfy(雨中飞燕) http:// **
*****************************************************************/
#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
void main()
{
char str[1024] = {0};
int Interger;
printf("输入一个数字:\n");
scanf("%s", str);
sscanf(str, "%d", &Interger);
printf("转换为整形:%d\n", Interger);
getch();
}