qfedu-cpp-level/day3/homework/h2.cpp

28 lines
365 B
C++
Raw Permalink Normal View History

2023-07-26 21:10:02 +08:00
#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
class Color
{
private:
int r, g, b;
public:
explicit Color(int r, int g = 0, int b = 0) : r(r), g(g), b(b)
{
}
void show()
{
cout << r << "," << g << "," << b << endl;
}
};
int main()
{
Color c = Color(2, 3, 4);
c.show();
return 0;
}