C++&datastructure书籍源码,以前外教提供现在与大家共享

源代码在线查看: gatewiredemo.cpp

软件大小: 202 K
上传用户: jxsflq
关键词: datastructure 书籍 源码
下载地址: 免注册下载 普通下载 VIP

相关代码

				#include 
				using namespace std;
				
				#include "gates.h"
				#include "wires.h"
				
				int main()
				{
				    Wire * in  =  new Wire();  // and-gate in
				    Wire * in2 =  new Wire();  // and-gate in
				    Wire * in3 =  new Wire();  // or-gate in 
				    Wire * aout = new Wire();  // and-gate out
				    Wire * oout = new Wire();  // or-gate out
				    
				    Gate * andg = new AndGate(in,in2,aout,"andgate");
				    Gate * org  = new OrGate(in3,andg->OutWire(0),oout);
				    cout 				    Probe * p = new Probe(aout);       // attach to the and-out wire
				    Probe * q = new Probe(oout);       // attach to the or-out wire
				
				    cout 				    in->SetSignal(true);
				    cout 				    in2->SetSignal(true);
				    cout 				    in->SetSignal(false);
				    cout 				    in3->SetSignal(true);
				    return 0; 
				}
							

相关资源