2008
06-04

#include <stdio.h>


        int main(void)


                   {


                            char year[4];


                            int x;


                                   for (x=0; x<4; x++)


                                        year[x] = getche();


                                   /* 设往 year 数组中输入数字 1,9,7,9 后,我如何将这四                                                                                个数转换成 int 型。 */


                    }


请教问题》有 2 条评论

  1. zcbzy 说:

    #include <stdlib.h>

    main()

    {

    char year[4];

    int x;

    int y;

    for (x=0;x<4;x++)

    year[x]=getche();

    y=atoi(year);

    printf(“y=%d”,y);

    }

  2. laozhao 说:

    终于知道了。

    感谢。

留下一个回复