Exemplo n.º 1
0
int main(int argc, char **argv)
{
	if (argc < 3)
		return __exception("Not found input file");

	int	 mRows1 = 0,
		mCols1 = 0,
		mRows2 = 0,
		mCols2 = 0;

	double ** matrix1 = __loadMatrix(argv[1], &mRows1, &mCols1);
	double ** matrix2 = __loadMatrix(argv[2], &mRows2, &mCols2);

	fprintf(stdout, "Matrix N1:\n");
	PrintMatrix(matrix1, mRows1, mCols1);
	fprintf(stdout, "Matrix N2:\n");
	PrintMatrix(matrix2, mRows2, mCols2);

	int zeroCount1 = GetCount(matrix1, mRows1, mCols1, true);
	int zeroCount2 = GetCount(matrix2, mRows2, mCols2, true);

	if (zeroCount1 < zeroCount2)
		fprintf(stdout, "Output matrix N1: %i\n", GetCount(matrix1, mRows1, mCols1, false));
	else
		fprintf(stdout, "Output matrix N2: %i\n", GetCount(matrix2, mRows2, mCols2, false));

	DestroyMatrix(matrix1, mRows1, mCols1);
	DestroyMatrix(matrix2, mRows2, mCols2);

	system("pause");
	return EXIT_SUCCESS;
}
Exemplo n.º 2
0
int main(int argc, char** argv)
{
	if (argc < 3) {
		return __exception("Not found input file");
	}

	int mRows1 = 0;
	int mCols1 = 0;
	int mRows2 = 0;
	int mCols2 = 0;
	double** matrix1 = __loadMatrix(argv[1], &mRows1, &mCols1);
	double** matrix2 = __loadMatrix(argv[2], &mRows2, &mCols2);

	fprintf(stdout, "Matrix N1:\n");
	__printMatrix(matrix1, mRows1, mCols1);
	fprintf(stdout, "Matrix N2:\n");
	__printMatrix(matrix2, mRows2, mCols2);

	double max1 = __findMaxElement(matrix1, mRows1, mCols1);
	double max2 = __findMaxElement(matrix2, mRows2, mCols2);

	if (max1 < max2) {
		fprintf(stdout, "Output matrix N1:\n");
		__outputMaxElements(matrix1, mRows1, mCols1);
	}
	else {
		fprintf(stdout, "Output matrix N2:\n");
		__outputMaxElements(matrix2, mRows2, mCols2);
	}
	__destroyMatrix(matrix1, mRows1, mCols1);
	__destroyMatrix(matrix2, mRows2, mCols2);
	system("pause");
	return EXIT_SUCCESS;
}
Exemplo n.º 3
0
int main(int argc, char **argv)
{
	if (argc < 3)
		return __exception("Not found input file");

	setlocale(0, "Russian");
	int  mRows1,mCols1,mRows2,mCols2,mtx1,mtx2 = 0;
	
	double ** matrix1 = __loadMatrix(argv[1], &mRows1, &mCols1);
	double ** matrix2 = __loadMatrix(argv[2], &mRows2, &mCols2);

	fprintf(stdout, "Матрица 1:\n");
	__printMatrix(matrix1, mRows1, mCols1);
	fprintf(stdout, "Матрица 2:\n");
	__printMatrix(matrix2, mRows2, mCols2);
	
	mtx1 = __calculate(matrix1, mRows1, mCols1);
	mtx2 = __calculate(matrix2, mRows2, mCols2);

	if (mtx1 < mtx2) {
		printf("Среднее арифметическое положительных элементов 1 матрици меньше.\n");
		__Count(matrix1, mRows1, mCols1);
	} else {
		printf("Среднее арифметическое положительных элементов 2 матрици меньше.\n");
		__Count(matrix2, mRows2, mCols2);
	}
	
	__destroyMatrix(matrix1, mRows1, mCols1);
	__destroyMatrix(matrix2, mRows2, mCols2);

	system("pause");
	return EXIT_SUCCESS;
}
Exemplo n.º 4
0
int main(int argc, char **argv)
{
	if (argc < 3)
		return __exception("Not found input file");

	int	 mRows1 = 0,
		mCols1 = 0,
		mRows2 = 0,
		mCols2 = 0;

	double ** matrix1 = __loadMatrix(argv[1], &mRows1, &mCols1);
	double ** matrix2 = __loadMatrix(argv[2], &mRows2, &mCols2);

	fprintf(stdout, "Matrix N1:\n");
	PrintMatrix(matrix1, mRows1, mCols1);
	fprintf(stdout, "Matrix N2:\n");
	PrintMatrix(matrix2, mRows2, mCols2);

	int S1 = Calculate(matrix1, mRows1, mCols1);
	int S2 = Calculate(matrix2, mRows2, mCols2);

	int row, cols;
	double ** matrix;

	if(S1 < S2)
	{
		matrix = matrix1;
		row = mRows1;
		cols = mCols1;
	}
	else
	{
		matrix = matrix2;
		row = mRows2;
		cols = mCols2;
	}

	for (int i = 0; i < row; i++)
		printf("Min element %i line = %3.1f\n", i+1, CalculateRow(matrix, i, cols));

	DestroyMatrix(matrix1, mRows1, mCols1);
	DestroyMatrix(matrix2, mRows2, mCols2);

	system("pause");
	return EXIT_SUCCESS;
}
Exemplo n.º 5
0
Arquivo: demo.cpp Projeto: xly931/demo
void
IceAsync::HSFoward::AMD_HSBnsProc_amdfun::ice_response(const ::std::string& __ret)
{
    if(__validateResponse(true))
    {
        try
        {
            ::IceInternal::BasicStream* __os = this->__os();
            __os->write(__ret);
        }
        catch(const ::Ice::Exception& __ex)
        {
            __exception(__ex);
            return;
        }
        __response(true);
    }
}
Exemplo n.º 6
0
void
IceAsync::GlobalTable::AMD_DistributedMap_putNget::ice_response(const ::std::string& counts)
{
    if(__validateResponse(true))
    {
        try
        {
            ::IceInternal::BasicStream* __os = this->__os();
            __os->write(counts);
        }
        catch(const ::Ice::Exception& __ex)
        {
            __exception(__ex);
            return;
        }
        __response(true);
    }
}