| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 493 人关注过本帖
标题:问几个问题
取消只看楼主 加入收藏
紫禁
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2011-12-7
结帖率:100%
收藏
已结贴  问题点数:15 回复次数:0 
问几个问题
程序代码:
/*x的值为什么是10,用笔算到貌似是11哎*/
#include <stdio.h>
main()
{
   int x,y;
   for(x=1,y=1;y<=50;y++)
   {
       if(x>=10)break;
       if(x%2==1)
       {
           x+=5;continue;
       }
       x-=3;
   }
       printf("x=%d,y=%d",x,y);
  
}



/*求分析下,y的值是怎样算出来的,用列举法把它一个个列举出来*/
#include <stdio.h>
main()
{
   int x,y;
   for(x=1,y=1;x<100;x++)
   {
       if(y>=20)break;
       if(y%3==1)
       {
           y=y+3;continue;
       }
       y=y-5;
   }
       printf("x=%d,y=%d",x,y);
  
}



/*现在无法调用isalpha函数,来实现如果输入的不是字母,就不统计出来*/
#include <stdio.h>
#include <string.h>
#define IN 1
#define OUT 0
int countword();
int isalpha();
main()
{
    int n;
    n=isalpha();
    n = countword( );
    printf("n=%d\n",n);
}
int isalpha()
{
    int c ;
    if(c>="a"&&c<="z")printf("%d",c);
   
}
int countword()
{
    int c,nw,state;
    state=OUT;
    nw=0;
    while((c=getchar())!='@')
    {
        if(c==' '||c=='\n'||c=='\t')
            state=OUT;
        else if(state==OUT)
        {
            state=IN;
            nw++;
        }
    }
    return nw;
}


/*ch=ch-32的意思是什么,是一个转换公式吗,是的话,那么大写转换小写的公式是什么*/
/*将小写字母转换成大写字母*/
#include <stdio.h>
#include <ctype.h>
char myupper(char ch)
{
    if(ch>='a'&&ch<='z')ch=ch-32; /*ch=ch-32的意思是什么*/
    return ch;
}
main()
{
    char c;
    while((c=getchar())!='@')
    {
        c=myupper(c);
        putchar(c);
    }
    return;
}
2012-02-07 13:11
快速回复:问几个问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013376 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved