12.27

1

#include <iostream>

using namespace std;
int mul(int a,int b,int c=10);
int main()
{
    cout << "input a b ";
    int a,b;
    cin >> a >> b;
    //cin >> b;
    cout << mul(a,b) << endl;
    return 0;
}
int mul(int a,int b,int c)
{
    return a*b*c;
}

2

#include <iostream>

using namespace std;

class stu{
private:
    int age;
    char sex;
    int high;
public:
    double score;
    int get_age();
    void set_age(int a);
    char get_sex();
    void set_sex(char b);
    int get_high();
    void set_high(int c);

};
int stu::get_age()
{
    return age;
}
void stu::set_age(int a)
{
    age=a;
}

char stu::get_sex()
{
    return sex;
}
void stu::set_sex(char b)
{
    sex=b;
}
int stu::get_high()
{
    return high;
}
void stu::set_high(int c)
{
   high=c;
}

int main()
{
    class  stu a;
    int x;
    char y;
    int z;
    int m;
    cout << "input age:";
    cin >> x;
    a.set_age(x);

    cout << "input sex:";
    cin >> y;
    a.set_sex(y);

    cout << "input high:";
    cin >> z;
    a.set_high(z);

    cout << "input score:";
    cin >> m;
    a.score=m;

    cout << "age=" << a.get_age() << endl;
    cout << "sxe=" << a.get_sex() << endl;
    cout << "high=" << a.get_high() << endl;
    cout << "score=" << a.score << endl;

    return 0;
}

3

有道云笔记

  • 9
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值