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


C++ correct函数代码示例

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


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

示例1: parsebf

int 
parsebf(char *buf)
{
   double rainrate, raintot;

   if (!sumcheck(buf, SIZEBF)) {
      errlog(8, "Checksum failure for BF block.");
      return (-1);
   }
   rainrate = (xDtoint(buf[2]) * 100) + DDtoint(buf[1]);
   raintot = (xDtoint(buf[6]) * 100) + DDtoint(buf[5]);

   correct(rainrate, current_cal.rain_rate_mul, current_cal.rain_rate_offs);
   correct(raintot, current_cal.rain_tot_mul, current_cal.rain_tot_offs);

   pthread_mutex_lock(&current_obs_lock);
   if (raintot < current_obs.rain_tot) {
      current_obs.rtot_offset += current_obs.rain_tot;
   }
   pthread_mutex_unlock(&current_obs_lock);

   update(current_obs.rain_rate, rainrate, RAINRATE);
   update(current_obs.rain_tot, raintot, RAINTOT);

   errlog2(9, "Rain rate %g mm/hr, Rain tot %g mm", rainrate, raintot);
}
开发者ID:glocklueng,项目名称:WeatherStation,代码行数:26,代码来源:parse.c

示例2: parseaf

int 
parseaf(char *buf)
{
   double baro, dewpt_in, dewpt_out;

   if (!sumcheck(buf, SIZEAF)) {
      errlog(8, "Checksum failure for AF block.");
      return (-1);
   }
   baro = DDtoint(buf[3]) + (DDtoint(buf[4]) * 100.0) + (xDtoint(buf[5]) * 10000.0);
   baro /= 10;

   dewpt_in = DDtoint(buf[7]);
   dewpt_out = DDtoint(buf[18]);

   correct(dewpt_in, current_cal.dp_in_mul, current_cal.dp_in_offs);
   correct(dewpt_out, current_cal.dp_out_mul, current_cal.dp_out_offs);
   correct(baro, current_cal.barometer_mul, current_cal.barometer_offs);

   update(current_obs.dp_in, dewpt_in, DEWIN);
   update(current_obs.dp_out, dewpt_out, DEWOUT);
   update(current_obs.barometer, baro, BARO);


   errlog1(9, "Barometer: %g mb", baro);
   errlog2(9, "Indoor dewpoint: %gC, Outdoor dewpoint: %gC", dewpt_in, dewpt_out);

}
开发者ID:glocklueng,项目名称:WeatherStation,代码行数:28,代码来源:parse.c

示例3: rmset

void ui::line(int x0, int y0, int x1, int y1, unsigned char color)
{
	if(y0==y1)
	{
		if(!correct(x0, y0, x1, y1, clipping))
			return;
		rmset(ptr(x0, y0), color, x1-x0+1);
	}
	else if(x0==x1)
	{
		if(!correct(x0, y0, x1, y1, clipping))
			return;
		linev(ptr(x0, y0), scanline, y1-y0+1, color);
	}
	else
	{
		int dx = iabs(x1-x0), sx = x0<x1 ? 1 : -1;
		int dy = -iabs(y1-y0), sy = y0<y1 ? 1 : -1;
		int err = dx+dy, e2;
		for(;;)
		{
			pixel(x0, y0, color);
			if(x0==x1 && y0==y1)
				break;
			e2 = 2*err;
			if(e2 >= dy) { err += dy; x0 += sx; }
			if(e2 <= dx) { err += dx; y0 += sy; }
		}
	}
}
开发者ID:Pavelius,项目名称:fallout2,代码行数:30,代码来源:bitmap.cpp

示例4: parse8f

int 
parse8f(char *buf)
{
   int hour, min, sec, day, mon;
   double hum_in, hum_out;
   if (!sumcheck(buf, SIZE8F)) {
      errlog(8, "Checksum failure for 8F block.");
      return (-1);
   }
   sec = DDtoint(buf[1]);
   min = DDtoint(buf[2]);
   hour = DDtoint(buf[3]);
   mon = xDtoint(buf[5]);
   day = DDtoint(buf[4]);
   hum_in = DDtoint(buf[8]);
   hum_out = DDtoint(buf[20]);

   current_obs.sec = sec;
   current_obs.min = min;
   current_obs.hour = hour;
   current_obs.month = mon;
   current_obs.day = day;

   correct(hum_in, current_cal.rh_in_mul, current_cal.rh_in_offs);
   correct(hum_out, current_cal.rh_out_mul, current_cal.rh_out_offs);

   update(current_obs.rh_in, hum_in, HUMIN);
   update(current_obs.rh_out, hum_out, HUMOUT);

   errlog5(9, "%s %d %.2d:%.2d:%.2d", month[mon], day, hour, min, sec);
   errlog2(9, "Indoor hum: %g%%, Outdoor hum: %g%%", hum_in, hum_out);
}
开发者ID:glocklueng,项目名称:WeatherStation,代码行数:32,代码来源:parse.c

示例5: disable

bool GameLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) {
	if (LOCAL_CONTEXT->firstRun()) { //第一次启动,点击取消帮助画面层
		this->removeHelpLayer();
		return false;
	}

	if (running) {
		disable();
		CCSprite *lastItem = items[0];
		long itemnum = (long) lastItem->getUserData();
		//CCDirector::sharedDirector()->replaceScene(FinishLayer::scene());
		CCSize winsize = CCDirector::sharedDirector()->getWinSize();
		CCPoint location = pTouch->getLocation();
		if (location.x < winsize.width / 2) {
			LOCAL_CONTEXT->playEffect("left.mp3");
			//瓶子 6-10
			if (itemnum >= 6) {
				correct(-0.32);
			} else {
				mistake(-0.32);
			}
		} else {
			LOCAL_CONTEXT->playEffect("right.mp3");
			//罐子 1-5
			if (itemnum <= 5) {
				correct(0.32);
			} else {
				mistake(0.32);
			}
		}
	}
	return false;

}
开发者ID:beforeeight,项目名称:sort,代码行数:34,代码来源:GameScene.cpp

示例6: bmeps_setup

void bmeps_setup(int psl, int col, int a85, int rl, int fl,
  int alpha, int trans, int altrig,
  int mix, int specbg, int bg_red, int bg_green, int bg_blue, int dsc_show
)
{
  is_configured = 1;
  bmeps_color = bmeps_enc_a85 = bmeps_enc_rl = bmeps_enc_fl = 0;
  bmeps_alpha = bmeps_trans = bmeps_altrig = 0;
  bmeps_mix = bmeps_specbg = 0;
  bmeps_bg_red = bmeps_bg_green = bmeps_bg_blue = 255;
  bmeps_pslevel = psl;
  bmeps_mix = (mix ? 1 : 0);
  bmeps_specbg = (specbg ? 1 : 0);
  bmeps_bg_red = bg_red;
  bmeps_bg_green = bg_green;
  bmeps_bg_blue = bg_blue;
  show_dsc_comments = dsc_show;
  correct(bmeps_bg_red);
  correct(bmeps_bg_green);
  correct(bmeps_bg_blue);
  if(bmeps_pslevel < 1) bmeps_pslevel = 1;
  if(bmeps_pslevel > MAXPSLEVEL) bmeps_pslevel = MAXPSLEVEL;
  if(bmeps_pslevel > 1) {
    bmeps_color = (col ? 1 : 0);
    bmeps_enc_a85 = (a85 ? 1 : 0);
    bmeps_enc_rl  = (rl  ? 1 : 0);
    if(bmeps_pslevel > 2) {
      bmeps_enc_fl = ( fl ? 1 : 0 );
      if(alpha) {
        bmeps_alpha = 1;
        bmeps_trans = (trans ? 1 : 0); bmeps_altrig = (altrig ? 1 : 0);
      }
    }
  }
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:35,代码来源:bmeps.c

示例7: NSStrSeqGet

//
// Extract the index'th string in the sequence
//
LPSTR NSStrSeqGet(NSstringSeq seq, LONG index)
{
  char* s;
  int N;

  if (!seq)
  {
    return NULL;
  }
  
  if (index<0)
  {
    return NULL;
  }
  
  if (!index)
    return correct(seq);
  
  for (s=seq+1,N=0; ((*s) || (*(s-1))) && (N<index); s++)
  {
    if (!(*s))
      N++;
  }
  
  if (N==index)
    return correct(s);
  
  return NULL;
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:32,代码来源:nsstrseq.cpp

示例8: InfIntException

const InfInt& InfInt::operator%=(const InfInt& rhs)
{
	if (rhs == zero)
	{
#ifdef INFINT_USE_EXCEPTIONS
		throw InfIntException("division by zero");
#else
		std::cerr << "Division by zero!" << std::endl;
		return zero;
#endif
	}
	InfInt D = (rhs.pos ? rhs : -rhs), N = (pos ? *this : -*this);
	bool oldpos = pos;
	val.clear();
	for (int i = (int)N.val.size() - 1; i >= 0; --i)
	{
		val.insert(val.begin(), (ELEM_TYPE)0);
		val[0] = N.val[i];
		correct(true);
		*this -= D * dInR(*this, D);
	}
	correct();
	pos = (val.size() == 1 && val[0] == 0) ? true : oldpos;
	return *this;
}
开发者ID:nex-7,项目名称:bmstu-projects,代码行数:25,代码来源:InfInt.cpp

示例9: parse9f

int 
parse9f(char *buf)
{
   double temp_in, temp_out;

   if (!sumcheck(buf, SIZE9F)) {
      errlog(8, "Checksum failure for 9F block.");
      return (-1);
   }
   temp_in = ((xDtoint(buf[2] & 0x07) * 100) + (DDtoint(buf[1]))) / 10;
   if (buf[2] & 0x08) {
      temp_in = -1.0 * temp_in;
   }
   temp_out = ((xDtoint(buf[17] & 0x07) * 100) + (DDtoint(buf[16]))) / 10;
   if (buf[17] & 0x08) {
      temp_out = -1.0 * temp_out;
   }

   if ((temp_out < -50.0) || (temp_in < -50.0)) return; /*Bad data*/

   correct(temp_in, current_cal.temp_in_mul, current_cal.temp_in_offs);
   correct(temp_out, current_cal.temp_out_mul, current_cal.temp_out_offs);

   update(current_obs.temp_in, temp_in, TEMPIN);
   update(current_obs.temp_out, temp_out, TEMPOUT);

   errlog2(9, "Indoor temp: %gC, Outdoor temp: %gC", temp_in, temp_out);
}
开发者ID:glocklueng,项目名称:WeatherStation,代码行数:28,代码来源:parse.c

示例10: tr_fl

int tr_fl(int q_no)
{
	char tf,ter;

	if(q_no==4)
	{
		ques(4);
		printf("\n\nAll metals are ductile.(t/f)");
		printf("\n\nType \"t\" for TRUE\tor \"f\" for FALSE");

		ter=check();

		if(ter==14)
			goto end;

		flushall();
		printf("\n\nYOUR OPINION:-\t");
		scanf("%c",&tf);
		if(tf=='f')
		{
			correct();
			return 1;
		}
		else
			printf("\n\n\a\aIT IS A FALSE STATEMENT");
		getch();
	}
	if(q_no==6)
	{
		ques(6);
		printf("\n\nUnicellular organisms have one celled body.(t/f)");
		printf("\n\nType \"t\" for TRUE\tor \"f\" for FALSE");
		ter=check();

		if(ter==14)
			goto end;

		flushall();
		printf("\n\nYOUR OPINION:-\t");
		scanf("%c",&tf);
		if(tf=='t')
		{
			correct();
			return 1;
		}
		else
			printf("\n\n\a\aIT IS A TRUE STATEMENT");
		getch();
	}
	end:
	return 0;
}
开发者ID:anirudhtomer,项目名称:UndergradCAssignments,代码行数:52,代码来源:DIVYA-PROJECT.C

示例11: parsecf

int 
parsecf(char *buf)
{
   double gust, avg, chill, hum_out;
   double avg_dir, gust_dir;

   if (!sumcheck(buf, SIZECF)) {
      errlog(9, "Checksum failure for CF block.");
      return (-1);
   }
   gust = ((xDtoint(buf[2]) * 100) + DDtoint(buf[1])) / 10;
   gust_dir = (Dxtoint(buf[2])) + (DDtoint(buf[3]) * 10);

   avg = ((xDtoint(buf[5]) * 100) + DDtoint(buf[4])) / 10;
   avg_dir = (Dxtoint(buf[5])) + (DDtoint(buf[6]) * 10);

   chill = DDtoint(buf[16]);
   if (buf[21] & 0x20) {
      chill = -1.0 * chill;
   }

#if 0
   pthread_mutex_lock(&current_obs_lock);
   if (((chill - current_obs.temp_out) > 0.5) && (avg > 0 || gust > 0)) {
      chill = -1.0 * chill;
   }
   pthread_mutex_unlock(&current_obs_lock);
#endif

   correct(chill, current_cal.chill_mul, current_cal.chill_offs);
   correct(gust, current_cal.gust_spd_mul, current_cal.gust_spd_offs);

   correct(gust_dir, current_cal.gust_dir_mul, current_cal.gust_dir_offs);
   correct(avg_dir, current_cal.wavg_dir_mul, current_cal.wavg_dir_offs);

   gust_dir = (gust_dir < 0) ? 360 + ((int) gust_dir % 360) : (int) gust_dir % 360;

   correct(avg, current_cal.wavg_spd_mul, current_cal.wavg_spd_offs);
   avg_dir = (avg_dir < 0) ? 360 + ((int) avg_dir % 360) : (int) avg_dir % 360;


   update(current_obs.gust, gust, GUST);
   update(current_obs.wavg, avg, WAVG);
   update(current_obs.gust_dir, gust_dir, GUSTDIR);
   update(current_obs.wavg_dir, avg_dir, WAVGDIR);
   update(current_obs.chill, chill, WCHILL);

   errlog2(9, "Wind gust %g m/s, direction: %g", gust, gust_dir);
   errlog2(9, "Wind avg  %g m/s, direction: %g", avg, avg_dir);
   errlog1(9, "Wind chill %g C", chill);
}
开发者ID:glocklueng,项目名称:WeatherStation,代码行数:51,代码来源:parse.c

示例12: ViWidget

ViMainCorrectionWidget::ViMainCorrectionWidget(QWidget *parent)
    : ViWidget(parent)
{
	mUi = new Ui::ViMainCorrectionWidget();
    mUi->setupUi(this);

	clear();

	mUi->projectLoader->setTypeMode(ViProjectLoader::NoTypes);
	QObject::connect(mUi->projectLoader, SIGNAL(finished()), this, SLOT(showContainer()));
	QObject::connect(mUi->projectLoader, SIGNAL(projectChanged()), this, SLOT(showContainer()));
	QObject::connect(mUi->projectLoader, SIGNAL(projectModeChanged()), this, SLOT(showContainer()));

	//Button
	QObject::connect(mUi->button, SIGNAL(clicked()), this, SLOT(correct()));
	mUi->button->setIcon(ViThemeManager::icon("startprocess"), 40);
	mUi->button->setText("Process");
	mUi->button->setSize(140, 60);

	//Label width
	QString style = "QLabel { width: 140px; min-width: 140px; }";
	mUi->projectLoader->setStyleSheet(style);
	mUi->container->setStyleSheet(style);

	// Correctors
	mUi->correctorComboBox->addItems(mUi->correctionWidget->correctors());
	QObject::connect(mUi->correctorComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCorrector()));
	changeCorrector();

	// Mode
	mUi->modeComboBox->addItems(ViCorrectionMode::modes());
	mUi->modeComboBox->setCurrentText(ViCorrectionMode::defaultMode());
	QObject::connect(mUi->modeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeMode()));
	changeMode();
}
开发者ID:EQ4,项目名称:Visore,代码行数:35,代码来源:vimaincorrectionwidget.cpp

示例13: psiThermo

Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo
(
    const fvMesh& mesh
)
:
    psiThermo(mesh, word::null),
    twoPhaseMixture(mesh, *this),
    thermo1_(NULL),
    thermo2_(NULL)
{
    {
        volScalarField T1(IOobject::groupName("T", phase1Name()), T_);
        T1.write();
    }

    {
        volScalarField T2(IOobject::groupName("T", phase2Name()), T_);
        T2.write();
    }

    thermo1_ = rhoThermo::New(mesh, phase1Name());
    thermo2_ = rhoThermo::New(mesh, phase2Name());

    thermo1_->validate(phase1Name(), "e");
    thermo2_->validate(phase2Name(), "e");

    correct();
}
开发者ID:OlegSutyrin,项目名称:OpenFOAM-3.0.x,代码行数:28,代码来源:twoPhaseMixtureThermo.C

示例14:

bool arlCore::FieldCorrector::correct( vnl_rigid_matrix &T ) const
{
    vnl_rigid_matrix T0;
    if(!correct(T, T0)) return false;
    T.copy(T0);
    return true;
}
开发者ID:corentindesfarges,项目名称:fw4spl,代码行数:7,代码来源:FieldCorrection.cpp

示例15: main

int main(int argc, const char *argv[]){
	int n, i, j, k;
	int count[20]={}, p[20]={};
	char str[16];
	word dict[SIZE], key;
	wordptr list[SIZE];

	for(n=0; gets(str), strcmp(str, "#"); ++n){
		k = strlen(str);
		++count[k];
		strcpy(dict[n].str, str);
		dict[n].len = k;
		dict[n].rank = n;
	}
	for(i=1; i<18; ++i) p[i] = p[i-1]+count[i-1];
	qsort(dict, n, sizeof(word), compar);

	while(gets(str), strcmp(str, "#")){
		strcpy(key.str, str);
		key.len = strlen(str);
		if(bsearch(&key, dict, n, sizeof(word), compar))
			printf("%s is correct\n", str);
		else{
			printf("%s:", str);
			for(i=p[key.len-1], j=0; i<p[key.len+2]; ++i)
				if(correct(str, dict[i].str, key.len-dict[i].len))
					list[j++] = (wordptr) {dict[i].str, dict[i].rank};
			qsort(list, j, sizeof(wordptr), comparRank);
			for(i=0; i<j; ++i) printf(" %s", list[i].str);
			putchar('\n');
		}
	}
	return 0;
}
开发者ID:0x7ffff,项目名称:POJ-archive,代码行数:34,代码来源:1035.c


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