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

📄 test.cpp

📁 A C++ code for generating sorting networks with n lines and m comparators as input parameters.
💻 CPP
字号:
#include<iostream>
using namespace std;
#include <cstdlib> 
#include <ctime> 
#include "Network.h"

void main1()
{
	int n, m;
	cout<<"Dati numarul de linii n: ";
	cin>>n;

	cout<<"Dati numarul de comparatoare m: ";
	cin>>m;

	Network network(n, m);

	for(int i=0; i<m; i++)
	{
		network.startLines[i]=i;
		network.endLines[i]=i+1;
	}

	int b[10];
	for(int i=0; i<10; i++)
		b[i]=i;
	b[5]=3;

	bool ok  = network.isOrdered(b, 10);

	for(int i=0; i<10; i++)
		b[i]=0;
	
	network.incrementBinary(b, 10);

	int s[4];
	for(int i=0; i<4; i++)
		s[i]=i;
	s[0]=9;

	network.sort(s);

	n=4; m=6;
	//retea buna
	//int startLines[6]={0, 1, 2, 0, 1, 0};
	//int endLines[6]={1, 2, 3, 1, 2, 1};
	
	//retea rea
	int startLines[6]={0, 1, 1, 0, 1, 0};
	int endLines[6]={1, 2, 2, 1, 2, 1};
	
	network.startLines=startLines;
	network.endLines=endLines;

	bool sortNet = network.isSortNetwork();

	
	system("pause");
}

⌨️ 快捷键说明

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