試撰寫一函數,repeat(3)即印出3次"Hello,C+

試撰寫一函數,repeat(3)即印出3次"Hello,C++",repeat(10)及印出10次"Hello,C++"。

3 Answers

Rating
  • 8 years ago
    Favorite Answer

    #include<stdio.h>

    #include<stdlib.h>

    int main(void){

    int repeat(int );

    int i=0;

    printf("input : \n");

    scanf("%d",&i);

    repeat(i);

    system("pause");

    return 0;

    }

    int repeat(int n){

    int i;

    for(i=0;i<n;i++)

    printf("Hello,C++\n");

    return 0;

    }

    Source(s): 自己
  • 卸貨
    Lv 5
    8 years ago

    #include < stdio.h >

    void repeat(int i){if(i==3)printf("%s","Hello,C++""Hello,C++""Hello,C++");else if(i==10)printf("%s","Hello,C++""Hello,C++""Hello,C++""Hello,C++""Hello,C++""Hello,C++""Hello,C++""Hello,C++""Hello,C++""Hello,C++");}

  • 8 years ago

    你連這幼稚園級的C程式,都懶得自行撰寫嗎?

    若是,放棄吧~

Still have questions? Get your answers by asking now.