第5课 (用户定义的函数)

#include <iostream>               
#include <cmath>
void simon(int n);//函数声明
int main(void)
{
    using namespace std;

    int n;
    cout << "请输入小狗个数" << endl;
    cin >> n;
    simon(n);    //函数调用
    return 0;
}
void simon(int n)//函数定义
{
    using namespace std;
    cout << "" << n << "只小狗" << endl;
}

 

posted @ 2021-04-18 09:34  梦之心  阅读(73)  评论(0编辑  收藏  举报