c-canf()vs get()vs fget()
scanf()
, gets()
fgets()
#include <stdio.h>#define MAX 100int CharToInt(const char *);int main(){ char str[MAX]; printf(" Enter some numbers (no spaces): "); gets(str);// fgets(str, sizeof(str), stdin);// scanf("%s", str); printf(" Entered number is: %d\n", CharToInt(str)); return 0;}int CharToInt(const char *s){ int i, result, temp; result = 0; i = 0; while(*(s+i) != '\0') { temp = *(s+i) & 15; result = (temp + result) * 10; i++; } return result / 10;}
gets()
fgets()
fgets()
scanf()
gets()
fgets()
scanf()
元芳怎么了
慕田峪9158850
相关分类