当前位置: 首页>>代码示例>>C++>>正文


C++ minValue函数代码示例

本文整理汇总了C++中minValue函数的典型用法代码示例。如果您正苦于以下问题:C++ minValue函数的具体用法?C++ minValue怎么用?C++ minValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了minValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setValue

void QRangeControl::subtractLine()
{
    if ( value() - lineStep() < value() )
	setValue( value() - lineStep() );
    else
	setValue( minValue() );
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:7,代码来源:qrangecontrol.cpp

示例2: maxValue

//! Determine the value corresponding to a specified point
double QwtWheel::getValue( const QPoint &p )
{
    // The reference position is arbitrary, but the
    // sign of the offset is important
    int w, dx;
    if ( orientation() == Qt::Vertical )
    {
        w = d_data->sliderRect.height();
        dx = d_data->sliderRect.y() - p.y();
    }
    else
    {
        w = d_data->sliderRect.width();
        dx = p.x() - d_data->sliderRect.x();
    }

    // w pixels is an arc of viewAngle degrees,
    // so we convert change in pixels to change in angle
    const double ang = dx * d_data->viewAngle / w;

    // value range maps to totalAngle degrees,
    // so convert the change in angle to a change in value
    const double val = ang * ( maxValue() - minValue() ) / d_data->totalAngle;

    // Note, range clamping and rasterizing to step is automatically
    // handled by QwtAbstractSlider, so we simply return the change in value
    return val;
}
开发者ID:AlexKraemer,项目名称:RFID_ME_HW_GUI,代码行数:29,代码来源:qwt_wheel.cpp

示例3: nrAtoms

    int nrAtoms(soil::Crit3DLayer* layers, int nrLayers, double rootDepthMin, double* minThickness, int* atoms)
    {
        int multiplicationFactor = 1;

        if (rootDepthMin > 0)
            *minThickness = rootDepthMin;
        else
            *minThickness = layers[1].thickness;

        for(int i=1; i<nrLayers; i++)
            *minThickness = minValue(*minThickness, layers[i].thickness);

        double tmp = *minThickness * 1.001;
        if (tmp < 1)
            multiplicationFactor = (int)(pow(10.0,-orderOfMagnitude(tmp)));

        if (*minThickness < 1)
        {
            *minThickness = 1./multiplicationFactor;
        }

        int value;
        int counter = 0;
        for(int i=0; i<nrLayers; i++)
        {
           value = int(round(multiplicationFactor * layers[i].thickness));
           atoms[i] = value;
           counter += value;
        }
        return counter;
    }
开发者ID:ftomei,项目名称:CRITERIA-3D,代码行数:31,代码来源:root.cpp

示例4: orientation

void LinearGauge::saveSettings( QSettings& pSettings )
{
	// Range
	pSettings.setValue("orientation", orientation());
	pSettings.setValue("scalePosition", scalePosition());
	pSettings.setValue("minValue", minValue());
	pSettings.setValue("maxValue", maxValue());

	// Ticks
	pSettings.setValue("scaleMaxMajor", scaleMaxMajor());
	pSettings.setValue("scaleMaxMinor", scaleMaxMinor());
	pSettings.setValue("labels", scaleDraw()->hasComponent( QwtAbstractScaleDraw::Labels ));
	pSettings.setValue("font", font().family());
	pSettings.setValue("fontSize", font().pointSize());

	// Pipe
	pSettings.setValue("value", value());
	pSettings.setValue("pipeWidth", pipeWidth());
	pSettings.setValue("pipeColor", fillBrush().color().rgb());

	// Alarm
	pSettings.setValue("alarmEnabled", alarmEnabled());
	pSettings.setValue("alarmLevel", alarmLevel());
	pSettings.setValue("alarmBrush", alarmBrush().color().rgb());

	// Color
	pSettings.setValue("textColor", textColor().rgb());
	pSettings.setValue("backgroundColor", backgroundColor().rgb());

	AbstractGauge::saveSettings( pSettings );
}
开发者ID:emreaslan,项目名称:zenom,代码行数:31,代码来源:lineargauge.cpp

示例5: delete_key

struct Node* delete_key(struct Node *root, int key){
	
	if(root == NULL){
		return root;
	}
	if(key < root->data){
		root->left = delete_key(root->left,key);
	}else if(root->data < key){
		root->right = delete_key(root->right,key);
	}else{
		//delete node with 0 or 1 child
		if(root->left == NULL){
			struct Node *temp = root->right;
			free(root);
			printf("\nproblem : %d",temp->data);
			return temp;
		}else if(root->right == NULL){
			struct Node *temp = root->left;
			free(root);
			return temp;
		}
	    //delete node with 2 child
	    struct Node *temp = minValue(root->right);
	    root->data = temp->data;
	    root->right = delete_key(root->right,temp->data);
	}
	return root;
}
开发者ID:BhuwanBhaskar,项目名称:Interview-Preparation,代码行数:28,代码来源:binarySearchTree.cpp

示例6: distanceOfUint32

 int distanceOfUint32(const vector<uint32_t> &w1, const vector<uint32_t> &w2)
 {
     int len1 = w1.size();
     int len2 = w2.size();
     int memo[100][100];
     memset(memo, 0x00, 100 * 100 * sizeof(int));
     for(int i = 1; i <= len1; ++i)
     {
         memo[i][0] = i;
     }
     for(int j = 1; j <= len2; ++j)
     {
         memo[0][j] = j;
     }
     
     for(int i = 1; i <= len1; ++i)
     {
         for(int j = 1; j <= len2; ++j)
         {
             if(w1[i-1] == w2[j-1])
             {
                 memo[i][j] = memo[i-1][j-1];
             }else
             {
                 memo[i][j] = minValue(memo[i-1][j-1], memo[i][j-1], memo[i-1][j]) + 1;
             }
         }
     }
    // std::cout << memo[len1][len2]<<"____" << std::endl;
     return memo[len1][len2];
 }
开发者ID:Beatrice7,项目名称:CPP_RECORD,代码行数:31,代码来源:StringUtils.cpp

示例7: eval

int AgentAB::maxValue(int depth, int alpha, int beta) {
		//returns a value and an action in vector<int> ansMove
		//within the depth limit
		if (depth == 0)
				return eval(searchState_);
		int v = INT_MIN;
		vector<vector<int> >moveList = searchState_.successor(MAX);	
		if (depth == depthLimit && moveList.size() != 0) { // if there is a legal movement, at least use it
				ansMove[0] = moveList[0][0];
				ansMove[1] = moveList[0][1];
		}
		vector<vector<int> >::iterator iter;
		vector<int> tmpPos;
		for (iter = moveList.begin(); iter != moveList.end(); iter++) {
				tmpPos = searchState_.maxPos;
				searchState_.update(MAX, *iter);
				int tmp = minValue( depth - 1, alpha, beta);
				searchState_.moveBack(MAX,  tmpPos);
				if (v < tmp) {
						v = tmp;
						if (depth == depthLimit) 
								ansMove = (*iter);														
				}
				if (v >= beta)
						return v;
				alpha = max(v, alpha);
		}
		return v;
}
开发者ID:popeliao,项目名称:isolation-AI-player,代码行数:29,代码来源:player.cpp

示例8: minValue

/* Given a non-empty binary search tree(ordered)
   returns the minimum data value found on tree */
int minValue(struct node* root)
{
	if(root->left == 0)
		return root->data;
	else 
		return minValue(root->left);
}
开发者ID:syamgk,项目名称:Data_Structures,代码行数:9,代码来源:printPaths.c

示例9: distanceOfString

    int distanceOfString(const std::string &strA, const std::string &strB)
    {

        int lenA = (int)strA.length()+1;
        int lenB = (int)strB.length()+1;

        int **c = new int*[lenA];
        for(int i = 0; i < lenA; i++)
            c[i] = new int[lenB];

        for(int i = 0; i < lenA; i++) c[i][0] = i;
        for(int j = 0; j < lenB; j++) c[0][j] = j;

        for(int i = 1; i < lenA; i++)
        {
            for(int j = 1; j < lenB; j++)
            {
                if(strB[j-1] == strA[i-1])
                    c[i][j] = c[i-1][j-1];
                else
                    c[i][j] = minValue(c[i][j-1], c[i-1][j], c[i-1][j-1]) + 1;
            }
        }

        int ret =  c[lenA-1][lenB-1];

        for(int i = 0; i < lenA; i++)
            delete [] c[i];
        delete []c;

        return ret;
    }
开发者ID:Beatrice7,项目名称:CPP_RECORD,代码行数:32,代码来源:StringUtils.cpp

示例10: vms

//==============================================================================
Move MoveSelector::GetBestMove(const value_type &maxDepth) const
{
    BitBoardPtr spBoard = m_wpBoard.lock();

    ValidMoveSet vms(m_wpMoveSet, spBoard);
    MoveList moves = vms.GetMyValidMoves();

    value_type bestValue = s_negInfinity;
    Move bestMove;

    for (auto it = moves.begin(); it != moves.end(); ++it)
    {
        BitBoardPtr spResult = result(spBoard, *it);

        value_type oldVal = bestValue;
        value_type min = minValue(spResult, maxDepth, s_negInfinity, s_posInfinity);
        bestValue = std::max(bestValue, min);

        if (bestValue > oldVal)
        {
            bestMove = *it;
        }
    }

    return bestMove;
}
开发者ID:trflynn89,项目名称:chessmate,代码行数:27,代码来源:move_selector.cpp

示例11: minValue

void SliderBase::wheelEvent(QWheelEvent *e)
{
	if(_ignoreMouseWheel)
	{
		e->ignore();
		return;
	}

	e->accept();

	float inc = (maxValue() - minValue()) / 40;
	if (e->modifiers() == Qt::ShiftModifier)
		inc = inc / 10;

	if (inc < step())
		inc = step();

	if (e->delta() > 0)
		setValue(value() + inc);
	else
		setValue(value() - inc);

	emit sliderMoved(value(), _id);
	emit sliderMoved((int)value(), _id);
}
开发者ID:Adamiko,项目名称:los,代码行数:25,代码来源:sliderbase.cpp

示例12: isBST

/**
 * [isBST description]
 * @param  node [description]
 * @return      [description]
 */
int isBST(struct node* node)
{
  if(node == NULL)
  {
    return 1;
  }
  else
  {
    if((node->left != NULL) && (minValue(node->left) > node->data))
    {
      return 0;
    }

    if((node->right != NULL) && (maxValue(node->right) <= node->data))
    {
      return 0;
    }

    if(!isBST(node->left) || !isBST(node->right))
    {
      return 0;
    }

    return 1;
  }
}
开发者ID:adityaguptacmu,项目名称:winter_art,代码行数:31,代码来源:tree.c

示例13: maxValue

void QmitkNumberPropertySlider::adjustFactors(short newDecimalPlaces, bool newShowPercents)
{
  int oldMax = maxValue();
  int oldMin = minValue();

  m_DecimalPlaces = newDecimalPlaces;
  m_ShowPercents = newShowPercents;

  m_FactorPropertyToSlider = pow(10.0,m_DecimalPlaces);
  m_FactorSliderToDisplay = 1.0 / m_FactorPropertyToSlider;

  // commented line would set the default increase/decrease to 1.0, no matter how many decimal places are available
  //setLineStep( ROUND(m_FactorPropertyToSlider) );

  if ( m_ShowPercents )
  {
    m_FactorPropertyToSlider *= 100.0;
    //setLineStep( ROUND(0.01 *m_FactorPropertyToSlider) );
    //setSuffix("%");
  }
  else
  {
    //setSuffix("");
  }

  setMinimum(oldMin);
  setMaximum(oldMax);
}
开发者ID:Maggunator,项目名称:MITK,代码行数:28,代码来源:QmitkNumberPropertySlider.cpp

示例14: value

/*!
  \brief Recalculate the marker angle corresponding to the
    current value
*/
void QwtKnob::recalcAngle()
{
    // calculate the angle corresponding to the value
    if ( maxValue() == minValue() )
    {
        d_data->angle = 0;
        d_data->nTurns = 0;
    }
    else
    {
        d_data->angle = ( value() - 0.5 * ( minValue() + maxValue() ) )
            / ( maxValue() - minValue() ) * d_data->totalAngle;
        d_data->nTurns = qFloor( ( d_data->angle + 180.0 ) / 360.0 );
        d_data->angle = d_data->angle - d_data->nTurns * 360.0;
    }
}
开发者ID:Alex-Rongzhen-Huang,项目名称:OpenPilot,代码行数:20,代码来源:qwt_knob.cpp

示例15: main

int main(){
    int size = 6;
    int arr[size];
    int arr1[6]={1,2,3,4,5,6};
    int arr2[6]={-11,-12,-13,-14,-15,-16};
    int res[6];
    int i;
    fillRand3(arr, size);

    for (i = 0; i < size; i++)
        printf("%d\t", arr[i]);
    printf("\nrez = %d\n",checkRand3(arr, size));
    printf("sred = %.3f\n",meanValue(arr, size));
    printf("min = %d\n", minValue(arr, size));
    printf("index= %i\n", meanIndex(arr, size));
    printf("index = %d\n", minIndex(arr, size));
    printf("elem = %d\n", maxOccurance(arr, size));
    printf("res = %d\n", diff(arr1, arr2, res, size));
    sub(arr1, arr2, res, size);
    for (i=0;i<size;i++)
        printf("%d\t", res[i]);
    printf("\neq= %d\n", eq(arr1, arr2, size));
    land(arr1, arr2, res, size);
    for (i=0;i<size;i++)
        printf("%d\t", res[i]);
    return 0;
}
开发者ID:Nastya67,项目名称:ForStudy,代码行数:27,代码来源:arrays.c


注:本文中的minValue函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。