What is the easiest way to get an int in a console app?

前端 未结 5 1234
暖寄归人
暖寄归人 2021-01-04 08:00

I want to process user input as an integer, but it seems as though C has no way to get an int from stdin. Is there a function to do this? How would I go about getting an int

5条回答
  •  日久生厌
    2021-01-04 08:55

    #include 
    
    main() {
    
        int i = 0;
        int k,j=10;
    
        i=scanf("%d%d%d",&j,&k,&i);
        printf("total values inputted %d\n",i);
        printf("The input values %d %d\n",j,k);
    
    }
    

    from here

提交回复
热议问题