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

📄 main.cpp

📁 这个程序主要是基于空时编码的编解码实现过程。
💻 CPP
字号:
#include <stdio.h>  
#include <iostream.h>
#include <stdlib.h>
#include <new.h>
#include <fstream.h>

#define _Global_
#include "Global.h"

void	Initialization( );
void	SimulationProcess( );
void	End( );

/******************************************************************************************
function : used for built in function
******************************************************************************************/
int handle_program_memory_depletion( size_t size )
{
	cout<< "Memory allocation failed, " << size << "bytes not available." << endl;
	exit (-1);
}

/******************************************************************************************
function : read the simulation parameters from the file
input    : ReadParameters( "filename.txt" )   
******************************************************************************************/
void ReadParameters( char *fname ) 
{
	fstream file;
	char tempChar[256];

	file.open( fname, ios::in|ios::nocreate );

	if( !file ) 
	{
		cout << "Error -- Cannot read the input file --> " << fname << endl;
		exit (-1);
	}
	else
	{
		file >> tempChar;		file >> _SimulationMode;
		file >> tempChar;		file >> _ChannelType;
		file >> tempChar;		file >> _SnrStart;
		file >> tempChar;		file >> _SnrStep;
		file >> tempChar;		file >> _SimPt;
		file >> tempChar;		file >> _BitErrNum;
		file >> tempChar;		file >> _MinBlockNum;
		file >> tempChar;		file >> _MaxBlockNum;
		file >> tempChar;		file >> _ItNum;
		file >> tempChar;		file >> _ReportGap;
		file >> tempChar;		file >> _TempReport;
		file >> tempChar;		file >>	_ScrambleNum;

		file.close( );
	}	
}

void RunTimeCheck( )
{
	int i;

	cout << "Continuous Simulation or New Simulation?" << endl;
	cin >> _RunTime;

	while( (_RunTime!=0) && (_RunTime!=1) )
	{
		cout << "Wrong Input!!" <<endl;
		exit (-1);
	}

	if( _RunTime == 0 ) cout << "Continuous Simulation. OK??" << endl;
	else cout << "New Simulation. OK??" << endl;

	cin >> i;
}

void main( int argc, char *argv[] )
{
	char *tmp;

	if( (tmp=argv[1]) == NULL ) tmp = "parameters.txt";
	_set_new_handler( handle_program_memory_depletion );
	RunTimeCheck( );
	ReadParameters( tmp );
	Initialization( );
	SimulationProcess( );
	End( );
}

⌨️ 快捷键说明

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