c38.cpp

来自「此文件可以能帮你求体积」· C++ 代码 · 共 47 行

CPP
47
字号
// c38.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "PR1.h"
#include "PR2.h"
#include <iostream.h>

int main(int argc, char* argv[])
{
	PR1 p1;
	PR2 p2;

	if ( !InUse( p1, p2 ) )
		cout << "Printer idle" << endl;
	cout << endl;

	cout << "Setting p1 to printing...\n";
	p1.SetPrint(1);
	if ( InUse( p1, p2 ) )
		cout << "Now, printer in use.\n";
	cout << endl;

	cout << "Turn off p1...\n";
	p1.SetPrint(0);
	if ( !InUse( p1, p2 ) )
		cout << "Printer idle\n";
	cout << endl;

	cout << "Turn on p2...\n";
	p2.SetPrint(1);
	if ( InUse( p1, p2 ) )
		cout << "Now, printer in use.\n";
	cout << endl;

	return 0;
}


int InUse( PR1 o1, PR2 o2 )
{
	if ( o1.printing || o2.printing )
		return 1;
	else
		return 0;
}

⌨️ 快捷键说明

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