Problem C: 类
Description:
设计一个复数类Cx,满足“Append Code”,完成程序。
Cx类由实部和虚部组成,类的功能有修改实部的re()函数和修改虚部的im()函数,输出由print()函数完成。
Input 输入为两个整数。
Output 见样例。
Sample Input
3 2
Sample Output
(3,2)
Append Code:
int main()
{
int m;
cin >> m;
func();
func(m, 100);
func(m, 23, -5);
}
int func(int a, int b, int c)
{
cout << "Number " << a << " " << b << " " << c << endl;
}
code:
#include <iostream>
using namespace std;
int func(int a, int b, int c);
int func()
{
cout << "Number " << 0 << " " << 0 << " " << 0 << endl;
}
int func(int a,int b)
{
cout << "Number " << a << " " << b << " " << 0 << endl;
}
int main()
{
int m;
cin >> m;
func();
func(m, 100);
func(m, 23, -5);
}
int func(int a, int b, int c)
{
cout << "Number " << a << " " << b << " " << c << endl;
}