asked in 電腦與網際網路程式設計 · 2 decades ago

C語言的題目 20點

請寫一個程式,會有以下輸出結果:

For he\'s a jolly good fellow!

For he\'s a jolly good fellow!

For he\'s a jolly good fellow!

Which nobody can deny!

程式必須包括main()函數,以及兩個使用者定義函數.使用者定義函數,一個會輸出jolly good一次,另一個則會輸出最後一行的訊息一次.

2 Answers

Rating
  • 2 decades ago
    Favorite Answer

    Message()

    {

    printf("For he's a jolly good fellow!\n");

    }

    Errormessage()

    {

    printf("Which nobody can deny!\n");

    }

    main()

    {

    char select ;

    scanf(" %c",&select );

    if(select =='y')

    Message();

    else

    Errormessage()

    }

    Source(s): 自己
  • 2 decades ago

    無聊問題...

    #include<stdio.h>

    void JGF()

    {

    puts("For he's a jolly good fellow!");

    }

    void NCD()

    {

    puts("Which nobody can deny!");

    }

    int main()

    {

    int i;

    for (i=1; i<=3; i++)

    JGF();

    NCD();

    getchar();

    }

Still have questions? Get your answers by asking now.