C语言的小程序怎么到VB来问了

解决方案 »

  1.   

    我不会C,瞎蒙的。
    int  x31=0;
    char chinput
    do
    {
    scanf("%c",&chinput);
    x31++;     //注意  
    printf("x=%d",x31);
    }while(chinput!='q');
    要么可能是这样,当然还是瞎蒙的。
    int  x31=0;
    char chinput
    do
    {
    scanf("%c",&chinput);
    printf("x=%d",++x31);//注意
    }while(chinput!='q');
      
      

  2.   

    或者系统把printf也当作一次输入
      

  3.   

    #include <stdio.h>int main()
    {
    int  x31=0;
    char chinput;
    while(chinput!='q')
    {
    scanf(" %c",&chinput);  //%c前面加个空格就行了
    printf("x=%d\n",++x31);
    }
    return 0;
    }  
      

  4.   

    沒錯,當用scanf時,是接受所有鍵盤輸入,回車它也會看成一個字符,解決方法可以如ozw 所說.
      

  5.   

    佩服OZW的功底,估计是计算机专业出生的!实在值得晚辈学习!