杂碎

作者: 小风xf | 来源:发表于2018-11-17 10:51 被阅读0次

减量

#include <stdio.h>

#define MAX1 100

void main()

{

    int count = MAX1 + 1;

    while (--count > 0 ) {

        printf("%d bttes pf spromg water on the wall " "%d botton of spring water !\n ", count,count);

        printf("take one down and pass it around , \n ");

        printf("%d bottles of spring water !\n ", count-1 );

    }

}

__

自动类型转换

#include <stdio.h>

#define MAX1 100

void main()

{

    char ch ;

    int i ;

    float f1;

    f1 = i = ch ='C';

    printf( "ch = %c , i = %d ,f1 = %2.2f \n",ch ,i ,f1);

    ch +=1;

    i = f1 +2 * ch ;

    f1 =2.0 *ch +1;

    printf( "ch = %c , i = %d ,f1 = %2.2f \n",ch ,i ,f1);

    ch =52222.11;

    printf("NOW ch = %c \n",ch);

}

定义带有一个参数的函数

#include <stdio.h>

void pound (int n)

{

    while (n -- > 0) {

        printf("#");

    }

   printf("\n");

}

void main()

{

    int times = 5;

    char ch = '!';

    float f = 8.9;

    pound( times);

    pound(ch);

    pound((int)f);

}

\

#include <stdio.h>

const int S_PER_M = 60;

const int S_PER_H = 3600;

const double M_PER_K = 0.62137;

int main()

{

    double distk , distm;

    double rate ;

    int min , sec ;

    int time ;

    double mtime ;

    int mmin , msec ;

    printf("This program converts your time for a metric race \n");

    printf("to a time for running a mile and to your average\n");

    printf("speed in miles per hour .\n");

    printf("please enter , in kilometers , the distance run .\n");

    scanf("%lf",&distk );

    printf("Next enter the time in minutes and seconds .\n");

    printf("Begin by entering the minutes .\n");

    scanf("%d",&min);

    printf("Now enter the secondes \n");

    scanf("%d",&sec);

    time =S_PER_M * min + sec ;

    distm =M_PER_K * distk ;

    rate = distm  / time *S_PER_H;

    mtime = (double) time / distm;

    mmin = (int ) mtime /distk;

    mmin = (int)mtime % S_PER_M;

    printf("you ran %1.2f km  (%1.2f miles ) in %d min , %d sec .\n",distk ,distm ,min ,sec);

    printf("that pace correponds to runing a mile in %d min",mmin);

    printf("%d sec .\n your average speed was %1.2f mph .\n",msec , rate);

}

相关文章

  • 2017-10-25

    杂碎

  • 《来份杂碎》

    ** 杂碎虽不起眼,但背后是中美双方复杂有趣的文化流史。**本书的 "杂碎" , “炒杂碎”是一道历史悠久的名菜,...

  • 流浪者

    《先生》第五章 他想起了那个杂碎! 他想起了那杂碎的眼睛,带着鄙夷的嘲戏, 他想起了那杂碎兴奋地抖着下面,流出金黄...

  • 请吃一碗杂碎汤,你接受吗

    对于杂碎汤,许多人不敢吃,甚至厌憎,而我偏偏嗜好。捧一碗杂碎汤,在鲜香热乎的气息下,顿时有肝肠寸柔的感受。 杂碎汤...

  • 西宁必吃特色老字号,牛杂碎真乃一绝

    早上起了个大早来到了这边既特色又有名的一家杂碎店,点了20元的牛杂碎,他家其实杂碎分着20元、25元、30元、40...

  • 买车梦

    一大早上的又忍不住打人了。那狗杂碎真他妈的不是人,连东西都不是,就是一堆杂碎,狗杂碎!看见他的第一刻我就恨不...

  • 杂碎

    天怕沙尘暴, 地怕长年荒。 男怕入错行, 女怕嫁错郎。 幼年怕没娘, 老年怕卧床。

  • 杂碎

    是夜 伏桌疾书 唯心 裹挾惆怅和失落 繁华的世界 我相识了一场寂寞 院深深 日落月升 独自...

  • 杂碎

    身微囊空两袖寒,廖备纸笔伴朝晚。 可怜落魄无人问,维持生计多艰难。 枯草己是深秋后,潇洒飘飞不怆神。 忆昔春凤吹到...

  • 杂碎

    天上闪电天撇火, 地上烧砖地冒烟。 榆树剥皮成光棍, 花椒开口见黑心。 官不在大,有权则名。 位不在尊,有利则灵。...

网友评论

      本文标题:杂碎

      本文链接:https://www.haomeiwen.com/subject/ayybfqtx.html