⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1051107547-q1.txt

📁 c++ progamming example
💻 TXT
字号:
//Muhammad 'Ifwan B. Md Jalal
//1051107547
//tutorial4b

#include <iostream>
using namespace std;

//create class with constructur
class CInt {			
public:
	CInt() {num = 0;};	//declare default constructur
	CInt(int c) {num = c;}; //daclare parameterized constructur
	void addCInt(CInt c1, CInt c2);				//initialized member function of addCint
	void displayNumber() {cout << endl << num << endl;};    //initialized member function of display number

private:
	int num;		//declare integer variable

};

void CInt::addCInt(CInt c1, CInt c2)  //declare function addCint
{
	num = c1.num + c2.num;	
};


void main() 			 //main function
{
	CInt i1(2), i2(4), i3;
	i3.addCInt(i1,i2);	//call the function
	i3.displayNumber();	//call the function

};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -