From owner-freebsd-ports@FreeBSD.ORG Tue Nov 16 15:37:39 2004 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1681516A4CE for ; Tue, 16 Nov 2004 15:37:39 +0000 (GMT) Received: from web20225.mail.yahoo.com (web20225.mail.yahoo.com [216.136.227.2]) by mx1.FreeBSD.org (Postfix) with SMTP id DC7B343D1F for ; Tue, 16 Nov 2004 15:37:38 +0000 (GMT) (envelope-from jianweirong@yahoo.com) Received: (qmail 95795 invoked by uid 60001); 16 Nov 2004 15:37:38 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=OqlawEaD9ZVxwKK6M0AkQjjj36WIWY8xEakTuLovJIsEQq/DB6/fS/ruwQgDEkLcSVMTf/vVAbCqGbNF2c224rkS2h8TDzDRT0+PzTDC09DctdebT6Ed3gBy6YiQ3doCHaEvNpWFxG5ZyWlWl+iuHe13OFPrrFkQZQDCwZ8JFJg= ; Message-ID: <20041116153738.95792.qmail@web20225.mail.yahoo.com> Received: from [221.216.143.91] by web20225.mail.yahoo.com via HTTP; Tue, 16 Nov 2004 23:37:38 CST Date: Tue, 16 Nov 2004 23:37:38 +0800 (CST) From: Jianwei Rong To: ports@freebsd.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0-269919899-1100619458=:93942" Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Wed, 17 Nov 2004 13:37:25 +0000 cc: ports@freebsd.org Subject: Maybe a error X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Nov 2004 15:37:39 -0000 --0-269919899-1100619458=:93942 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: 8bit Content-Id: Content-Disposition: inline subject: Maybe a error Good afternoon, I found some display problem on running EX2-6-1.c in cce -e bash of FreeBSD4.10. Please try it yourself. Best Regards. rongjianwei 2004/11/15 *********************************************************** /* count digits, white space, others in input 对数字、分隔符(空格、制表符、换行符)和所有其他字符出现的次数进行计数 file name: EX2-6-1.c*/ #include main() { int c, i, nwhite, nother; int ndigit[10]; //定义数组 nwhite = nother = 0; //计数器的初始值设为0。 for(i = 0; i<10; ++i) ndigit[i] = 0; while((c=getchar()) != EOF) if(c>'0' && c<='9') /* 操作符&&的含义是与。c为ASCII字符0到9之间, 就满足该if语句的条件*/ ++ndigit[c - '0']; //请复习ASCII码表。'0'表示0的ASCII码值。 else if(c==' ' || c=='\n' || c=='\t') ++nwhite; else ++nother; printf("digits=\n"); for(i = 0; i<10; ++i) printf("digit%d=%d\t", i, ndigit[i]); printf("\nwhite space = %d, \tother = %d \n", nwhite, nother); } ******************************************************* _________________________________________________________ Do You Yahoo!? 150万曲MP3疯狂搜,带您闯入音乐殿堂 http://cn.rd.yahoo.com/mail_cn/tag/yisou/music/*http://music.yisou.com/ 美女明星应有尽有,搜遍美图、艳图和酷图 http://cn.rd.yahoo.com/mail_cn/tag/yisou/image/*http://image.yisou.com 1G就是1000兆,雅虎电邮自助扩容! http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/ --0-269919899-1100619458=:93942 Content-Type: text/plain; name="EX2-6-1.c" Content-Description: EX2-6-1.c Content-Disposition: inline; filename="EX2-6-1.c" /* count digits, white space, others in input 对数字、分隔符(空格、制表符、换行符)和所有其他字符出现的次数进行计数 file name: EX2-6-1.c*/ #include main() { int c, i, nwhite, nother; int ndigit[10]; //定义数组 nwhite = nother = 0; //计数器的初始值设为0。 for(i = 0; i<10; ++i) ndigit[i] = 0; while((c=getchar()) != EOF) if(c>'0' && c<='9') /* 操作符&&的含义是与。c为ASCII字符0到9之间, 就满足该if语句的条件*/ ++ndigit[c - '0']; //请复习ASCII码表。'0'表示0的ASCII码值。 else if(c==' ' || c=='\n' || c=='\t') ++nwhite; else ++nother; printf("digits=\n"); for(i = 0; i<10; ++i) printf("digit%d=%d\t", i, ndigit[i]); printf("\nwhite space = %d, \tother = %d \n", nwhite, nother); } --0-269919899-1100619458=:93942--