本文整理汇总了C++中Calc函数的典型用法代码示例。如果您正苦于以下问题:C++ Calc函数的具体用法?C++ Calc怎么用?C++ Calc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Calc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StrDbl
//---------------------------------------------------------------------
// 検索と置き換えの実行
int __fastcall TValRepDlg::Execute(double &nd, double &od)
{
double od1, od2;
double nd1, nd2;
int f = FALSE;
RepSel->Enabled = FALSE;
InvSel->Enabled = FALSE;
EditOld->Text = StrDbl(od);
EditNew->Text = StrDbl(od);
Calc(od1, AnsiString(EditOld->Text).c_str());
Calc(nd1, AnsiString(EditNew->Text).c_str());
if( ShowModal() == IDOK ){
Calc(od2, AnsiString(EditOld->Text).c_str());
Calc(nd2, AnsiString(EditNew->Text).c_str());
if( od1 != od2 ){
od = od2;
}
if( nd1 != nd2 ){
nd = nd2;
}
if( od != nd ) f = TRUE;
}
return f;
}
示例2: switch
void MainWindow::operations(int i)
{
switch (i)
{
case '+':
case '*':
case '/':
case '-':
arg = Calc(arg, ui->lineEdit->text().toInt(), operation);
ui->lineEdit->setText(QString::number(arg));
valueChanged = true;
operation = i;
break;
case 'C':
ui->lineEdit->setText("0");
arg = 0;
operation = '+';
valueChanged = false;
break;
case '=':
arg = Calc(arg, ui->lineEdit->text().toInt(), operation);
ui->lineEdit->setText(QString::number(arg));
valueChanged = true;
arg = 0;
operation = '+';
break;
}
}
示例3: Trig_eff
void Trig_eff(){
Char_t *Hijing_file = "/store/user/tuos/pPb_MC_MinBiasTree_v4_Hijing_180k.root";
Char_t *Hijing_outfile1 = "pPbHist_Hijing_Es.root";
Char_t *Hijing_outfile2 = "pPbHist_Hijing_Tr.root";
Char_t *Hijing_outfile3 = "pPbHist_Hijing_TrandEs.root";
Char_t *Epos_file = "/store/user/tuos/pPb_MC_MinBiasTree_v4_Epos_189k.root";
Char_t *Epos_outfile1 = "pPbHist_Epos_Es.root";
Char_t *Epos_outfile2 = "pPbHist_Epos_Tr.root";
Char_t *Epos_outfile3 = "pPbHist_Epos_TrandEs.root";
Char_t *condition1 = "ES";
Char_t *condition2 = "TR";
Char_t *condition3 = "TRandES";
ofstream fouttxt;
Char_t *outtxt="Eff_Result.txt";
fouttxt.open(outtxt);
//Calc(Hijing_file,Hijing_outfile1,condition1,fouttxt);
//Calc(Epos_file,Epos_outfile1,condition1,fouttxt);
//Calc(Hijing_file,Hijing_outfile2,condition2,fouttxt);
//Calc(Epos_file,Epos_outfile2,condition2,fouttxt);
Calc(Hijing_file,Hijing_outfile3,condition3,fouttxt);
Calc(Epos_file,Epos_outfile3,condition3,fouttxt);
fouttxt.close();
}
示例4: GO
void GO(int x,int fx){
int px=b[COT2::a[x]];BIT::I(px,-1);BIT::I(b[COT2::a[x]]=D[x]=fx==-1?1:D[fx]+1,1);
for(QUE*p=Q[x];p;p=p->next)if(!p->ans){
int fu=fa(p->u);if(!D[fu])continue;
p->ans=BIT::S(D[fu])+Calc(p->u,fu,x)+Calc(p->v,fu,x);
Clean(p->u);Clean(p->v);
}for(EDGE*p=COT2::map[x];p;p=p->next)if(!d[p->y]&&p->y!=fx)CT::T[p->y]=CT::I(CT::T[x],0,n,COT2::a[p->y]),GO(p->y,x);
BIT::I(b[COT2::a[x]]=px,1);BIT::I(D[x],-1);D[x]=0;
}inline bool Run(){
示例5: switch
//---------------------------------------------------------------------------
void __fastcall TMediaDlgBox::GridSetEditText(TObject *Sender, int ACol,
int ARow, const UnicodeString Value)
{
double d;
if( Grid->EditorMode == TRUE ) return;
if( ARow ){
ARow--;
switch(ACol){
case 1: // DIE(導)
if( Calc(d, AnsiString(Value).c_str()) == TRUE){
lenv.rel[ARow] = d;
GridNewLine(ARow);
}
break;
case 2: // COND(誘電)
if( Calc(d, AnsiString(Value).c_str()) == TRUE){
lenv.cond[ARow] = d/1000.0;
GridNewLine(ARow);
}
break;
case 3: // XorR(m)
if( *Value.c_str() ){
if( Calc(d, AnsiString(Value).c_str()) == TRUE){
lenv.intval[ARow] = d;
GridNewLine(ARow);
}
}
else if( ARow >= (lenv.mmax - 1) ){
lenv.intval[ARow] = NULLV;
GridNewLine(ARow);
}
break;
case 4: // H(m)
if( *Value.c_str() ){
if( Calc(d, AnsiString(Value).c_str()) == TRUE){
lenv.height[ARow] = d;
GridNewLine(ARow);
}
}
else if( ARow >= (lenv.mmax - 1) ){
lenv.height[ARow] = NULLV;
GridNewLine(ARow);
}
break;
}
}
}
示例6: Calc
void GasAccumStrategy::Calc(EndListRef &jun,MOCLumpedInertia &Inertia,double dPolytropic,double dCA,double &dMass,double &dPress,double &dVolume)
{
double dFun =0;
double dGrad = 0;
double dNewMass = 0;
double dStep = 5;
double dSign = 0;
Calc(jun,Inertia,dPolytropic,dCA,dMass,dPress,dVolume,dNewMass,dSign,dGrad);
while(TRUE)
{//查找根区间
dNewMass = dNewMass - dStep*dSign/fabs(dSign);
Calc(jun,Inertia,dPolytropic,dCA,dMass,dPress,dVolume,dNewMass,dFun,dGrad);
if(dFun/dSign <0)
break;
}
while(TRUE)
{//二分法
dStep = dStep / 2;
if(dFun > 0)
{
dNewMass = dNewMass - dStep;
}
else
{
dNewMass = dNewMass + dStep;
}
Calc(jun,Inertia,dPolytropic,dCA,dMass,dPress,dVolume,dNewMass,dFun,dGrad);
if(dStep < 0.01||fabs(dFun)<1E-2)
{
break;
}
}
int n=0;
while (n<100)
{//牛顿迭代
dNewMass = dNewMass -dFun/dGrad;
Calc(jun,Inertia,dPolytropic,dCA,dMass,dPress,dVolume,dNewMass,dFun,dGrad);
if(-1E-10<dFun&&dFun<1E-10)
break;
n++;
}
jun.BranchStrategy(dNewMass);
dVolume += MOCFluid::TranMassToV((dNewMass+dMass)/2);
dMass = dNewMass;
dPress = dCA/pow(dVolume,dPolytropic);
}
示例7: Calc
bool
nsCounterUseNode::InitTextFrame(nsGenConList* aList,
nsIFrame* aPseudoFrame, nsIFrame* aTextFrame)
{
nsCounterNode::InitTextFrame(aList, aPseudoFrame, aTextFrame);
nsCounterList *counterList = static_cast<nsCounterList*>(aList);
counterList->Insert(this);
bool dirty = counterList->IsDirty();
if (!dirty) {
if (counterList->IsLast(this)) {
Calc(counterList);
nsAutoString contentString;
GetText(contentString);
aTextFrame->GetContent()->SetText(contentString, false);
} else {
// In all other cases (list already dirty or node not at the end),
// just start with an empty string for now and when we recalculate
// the list we'll change the value to the right one.
counterList->SetDirty();
return true;
}
}
return false;
}
示例8: main
int main( )
{
int i, fi=0, sr, k=1;
while( gets(t) )
{
sr=-1;
for( i=0; i<strlen(t); i++ )
{
if( t[i] == '(' ) fi += LB;
else if( t[i] == ')' ) fi += RB;
else if( t[i] != ' ' )
{
s[++sr] = t[i];
switch( t[i] )
{
case '!' : f[sr] = fi + 2; break;
case '|' : f[sr] = fi + 0; break;
case '&' : f[sr] = fi + 1; break;
default : f[sr] = OO; break;
}
}
}
if( Calc( 0, sr ) )printf("Expression %d: V\n",k++);
else printf("Expression %d: F\n",k++);
}
return 0;
}
示例9: StrDbl
void __fastcall TACalInfoBox::AutoJXClick(TObject *Sender)
{
double R, MRO;
if( (Calc(R, AnsiString(EditSWRZ->Text).c_str()) == TRUE) && (R > 0.0) ){
UnicodeString MTZ = R < 50 ? "50" : StrDbl(R*2); //ja7ude 1.0
if( InputQuery("MMANA", "整合目標のZを入力", MTZ) == TRUE ){
if( (Calc(MRO, AnsiString(MTZ).c_str()) == TRUE) && (MRO > R) ){
EditSWRJX->Text = StrDbl(-(sqrt((MRO/R)-1) * R));
}
else {
EditSWRJX->Text = (MRO == R) ? "0":"";
}
}
}
}
示例10: main
int main(void) {
int i, peo, time,taxi,CalcAns,all;
double dist;
//input
for (i = 0; i <= 2; i++) {
if (i == 0) {
peo = (int)input(i);
}
else if (i == 1) {
dist = input(i);
}
else if (i == 2) {
time = (int)input(i);
}
}
//Calc
CalcAns = Calc(dist);
//time
CalcAns = timePlus(CalcAns,time);
//Taxi num
taxi = first(peo);
all = CalcAns*taxi;
//output
output(all,peo);
puts("\n\nSystem all ok");
return 0;
}
示例11: main
int main(void)
{
int t;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&n,&f);
int i;
double low = 0,high = 0;
for(i=0;i<n;i++)
{
scanf("%lf",pie+i);
if(pi*pie[i]*pie[i] > high)
high = pi*pie[i]*pie[i];
}
for(i=0;i<100;i++)
{
double mid = (low+high)/2;
if(Calc(mid) >= f+1)
low = mid;
else
high = mid;
}
printf("%.4lf\n",low);
}
return 0;
}
示例12: main
int main()
{
int cn, cc;
scanf("%d", &cn);
for (cc=1; cc<=cn; cc++)
{
BI a, b;
fprintf(stderr, "Processing Case #%d\n", cc);
Get(&a);
Get(&b);
/*
memset(&a, 0, sizeof(a));
memset(&b, 0, sizeof(b));
a.n[0] = 1;
b.n[SIZE-1] = 1;
*/
a = Sqrtsf(a, SEL);
b = Sqrtsf(b, FLR);
printf("Case #%d: %d\n", cc, Calc(a, b));
}
return 0;
}
示例13: FormAccount_UpdateRemain
void FormAccount_UpdateRemain(FormAccount* fa)
{
GtkTreeModel* model;
gdouble MoneyNow;
gdouble MoneyTotal;
gdouble MoneyRemain;
const gchar* Str;
gchar* StrEnd;
gchar Buf[100];
model = gtk_tree_view_get_model(GTK_TREE_VIEW(fa->ListViewAccount));
Str = gtk_entry_get_text(GTK_ENTRY(fa->EntryMoneyNow));
MoneyNow = g_strtod(Str, &StrEnd);
if (Calc(Str, &MoneyNow) == -1)
{
g_snprintf(Buf, sizeof(Buf), "<span foreground=\"#FF0000\">inv!</span>");
}
else
{
FormAccount_SumMoneyTotal(fa, model, &MoneyTotal);
MoneyRemain = MoneyNow - MoneyTotal;
g_snprintf(Buf, sizeof(Buf), "<span foreground=\"%s\">%.2f</span>",
MoneyRemain >= 0 ? "#00FF00" : "#FF0000",
MoneyRemain);
}
gtk_label_set_markup(GTK_LABEL(fa->LabelRemain), Buf);
}
示例14: switch
void SnowView::MessageReceived(BMessage *msg)
{
BAlert *info;
//msg->PrintToStream();
switch (msg->what) {
case MSG_PULSE_ME:
if (Parent()) {
Calc();
InvalFlakes();
}
break;
case B_ABOUT_REQUESTED:
info = new BAlert("BSnow info",
"BSnow, just in case you don't have real one...\n"
"" B_UTF8_COPYRIGHT " 2003, François Revol.",
"Where is Santa ??");
info->SetFeel(B_NORMAL_WINDOW_FEEL);
info->SetLook(B_FLOATING_WINDOW_LOOK);
info->SetFlags(info->Flags()|B_NOT_ZOOMABLE);
info->Go(NULL);
break;
default:
//#ifdef FORWARD_TO_PARENT
/*
if (fAttached && Parent())
Parent()->MessageReceived(msg);
else
*/
//#endif
BView::MessageReceived(msg);
}
}
示例15: UpdateData
void CCompressionOptionsPage::OnGetTime()
{
if (!Enc_Info.b_selectrange)
{
UpdateData(TRUE);
Enc_Info.b_gettimefromvob = m_bGetTime;
if (m_bGetTime)
{
m_lFrames = Enc_Info.l_frames;
m_lSeconds = (long) (m_lFrames / Enc_Info.f_framerate);
}
m_hour = m_lSeconds / 3600;
m_min = (-m_hour * 3600 + m_lSeconds) / 60;
m_sec = (-m_hour * 3600 - m_min * 60 + m_lSeconds);
RefreshWindow();
if (Enc_Info.b_enter_filesize == 1)
{
Calc();
}
else
{
CalcFileSize();
}
}
}