栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

一份作业(霉霉镇楼)

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

一份作业(霉霉镇楼)

 

#include 
 void  one_houzi_eat_peach();
 void  two_shuchu_sushu();
 void  three_zhifu_tongji_();
 void  four_print_shuixianhua_shu();
 void  five_search_themax_or_min_number();
 int main()
 {
     int n;
     scanf ("%d",&n);
     switch (n)
     {
         case 1:
          one_houzi_eat_peach();   
         break;
          case 2:
          two_shuchu_sushu();
          break;
           case 3:
           three_zhifu_tongji_();

           break;
            case 4:
            four_print_shuixianhua_shu();
            break;
            case 5:
            five_search_themax_or_min_number();
            break;
            if (n==6)
            break;
     }
     return 0;
 }
void  one_houzi_eat_peach()
{
    

    int i;
    int tao=1;
    for (i=0;i<9;i++)
    {
        tao+=1;
        tao*=2;

    }
    printf ("%d",tao);


}
void  two_shuchu_sushu()
{
 for (int i = 2; i>=100&&i<=200; ++i)
 {
  int flag = 1;

  for (int j = 2; j <= sqrt(i); ++j)
  {
   if (i%j == 0)
   {
    flag = 0;//用if来判定是否是素数
    break;
   }
  }

  if (flag)
  {
   printf("%dn", i);
  }
 }
}
void  three_zhifu_tongji_()

{
 char c;
 int letterCnt = 0, spaceCnt = 0, numCnt = 0, otherCnt = 0;
 while ((c = getchar()) != 'n')
 {
  if ((c >= 'a'&&c <= 'z') || (c >= 'A'&&c <= 'Z'))
  {
   letterCnt++;
  }
  else if (c == ' ')
  {
   spaceCnt++;
  }
  else if (c >= '0'&&c <= '9')
  {
   numCnt++;
  }
  else
  {
   otherCnt++;
  }
 }

 printf("英文字母个数为%dn", letterCnt);
 printf("空格个数为%dn", spaceCnt);
 printf("数字个数为%dn", numCnt);
 printf("其它字符个数为%d", otherCnt);

}
 void four_print_shuixianhua_shu()
{
 for (int i = 100; i < 1000; ++i)
 {
  int units, tens, huns;
  huns = i / 100;
  tens = i % 100 / 10;
  units = i % 10;
  if (i == huns*huns*huns + tens*tens*tens + units*units*units)
  {
   printf("%d ", i);
  }
 }

}
void  five_search_themax_or_min_number()
{
    int n;
    scanf ("%d",&n);
    int i;
    int a[100];
    for (i=0;imax)
        {
            a[i]=max;

        }
        

    }
    int k;
    for (k=0;k 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/656010.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号