鱼C论坛

 找回密码
 立即注册
查看: 3017|回复: 3

看不懂了,各位学长给看看。

[复制链接]
发表于 2011-9-30 01:40:49 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
#include<stdio.h>
#include<windows.h>
#include<conio.h>
/* MAIN PROGRAM: */
void main(void)
{
    int nInput;//input maxmium binary number
    int nResult = 0;
    char chAgain = 'y';
    //int nI =0;
    while(chAgain=='y')
     while ((0 == nInput) || (1 == nInput))
    {
        nInput = getche()-48;
        /*if ((0 == nInput) || (1 == nInput))//only 1 or 0
        {
            /* nJ=0;
            while(nJ<nI+1)
            {
             printf("%d",nInput[nJ]);
             nJ+=1;
            }*/
            nResult=nResult*2+nInput;
            printf("\t\nthe Decimal is:%d\n",nResult);

        /*}
        else
        {
            printf("\a input error.\n");
        }
        nI++;*/
        printf("Do you want to run this program again? [y/n]: ");
        chAgain = getche();

    }

}

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
 楼主| 发表于 2011-9-30 01:46:17 | 显示全部楼层
dfdb.jpg

还有选中的是什么意思,老师好变态,都不管我们。唯有求救于各位学长了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2011-9-30 09:28:50 | 显示全部楼层
1楼代码绝对有问题

2楼选中的意思是,问你是否要再运行一次这个程序,如果是“y”,那么继续while循环。实际就是要你输入判断是否跳出while循环而已
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2011-9-30 13:01:26 | 显示全部楼层
....代码好多错误
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-2-9 13:25

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表