本文整理汇总了C++中Calc函数的典型用法代码示例。如果您正苦于以下问题:C++ Calc函数的具体用法?C++ Calc怎么用?C++ Calc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Calc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:ja7ude,项目名称:MMANA,代码行数:27,代码来源:ValRep.cpp
示例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;
}
}
开发者ID:Andrew-Chernyavski,项目名称:hw_1_2,代码行数:29,代码来源:mainwindow.cpp
示例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();
}
开发者ID:XuQiao,项目名称:HI,代码行数:29,代码来源:Trig_eff.C
示例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(){
开发者ID:jki14,项目名称:e.ICPC.SCL.13,代码行数:9,代码来源:ChairTree_COT2.cpp
示例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;
}
}
}
开发者ID:ja7ude,项目名称:MMANA,代码行数:49,代码来源:MediaDlg.cpp
示例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);
}
开发者ID:uesoft,项目名称:AutoPFA,代码行数:48,代码来源:GasAccumStrategy.cpp
示例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;
}
开发者ID:BrunoReX,项目名称:palemoon,代码行数:26,代码来源:nsCounterManager.cpp
示例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;
}
开发者ID:AmazingCaddy,项目名称:acm-codelab,代码行数:27,代码来源:ecnu_1003.cpp
示例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":"";
}
}
}
}
开发者ID:ja7ude,项目名称:MMANA,代码行数:16,代码来源:ACalInfo.cpp
示例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;
}
开发者ID:no1fushi,项目名称:study,代码行数:28,代码来源:taxi.c
示例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;
}
开发者ID:SRITANU,项目名称:Spoj-1,代码行数:27,代码来源:PIE-6296188-src.cpp
示例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;
}
开发者ID:wx2486,项目名称:codejam,代码行数:28,代码来源:2013_0_c.c
示例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);
}
开发者ID:avgo,项目名称:avgmoney,代码行数:30,代码来源:form_account.c
示例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);
}
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:32,代码来源:SnowView.cpp
示例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();
}
}
}
开发者ID:StefH,项目名称:SimpleDivX,代码行数:29,代码来源:CompressionOptionsPage.cpp
示例16: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
int c = 0;
c = Calc(1, CFunc1(), CFunc2(), 2);
int e = Calc(1, CFunc1(), CFunc3(), 3);
int f = Calc(1, CFunc2(), CFunc3(), 4);
printf("c = %d, e=%d, f=%d\n", c,e,f);
int d = 0;
scanf("%d", &d);
return 0;
}
开发者ID:BGCX261,项目名称:zhhx-useful-code-svn-to-git,代码行数:18,代码来源:funcobject.cpp
示例17: main
//---------------------------------------------------------------------------
int main(int argc, char *argv[])
{
// The next line is just for shutting up the compiler warning
// about unused variables without getting another warning about not
// beeing able to use type lists in function declarations.
printf("Executing \"%s\" (argc=%d)\n", argv[0], argc);
Calc();
printf("done...");
}
开发者ID:10341074,项目名称:pacs,代码行数:10,代码来源:example2.c
示例18: Token
void Parser::Parse() {
t = NULL;
la = dummyToken = new Token();
la->val = coco_string_create(L"Dummy Token");
Get();
Calc();
Expect(0);
Expect(0);
}
开发者ID:Divo,项目名称:twominutestomidnightIMPORT,代码行数:9,代码来源:Parser.cpp
示例19: button_3
static void button_3(GtkWidget *win, GtkWidget *main_calc_box, GtkWidget *button)
{
button = gtk_button_new_with_label("Enter");
gtk_widget_set_hexpand(GTK_WIDGET(button), TRUE);
gtk_widget_set_vexpand(GTK_WIDGET(button), TRUE);
gtk_container_set_border_width(GTK_CONTAINER(button), 3);
g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(Calc().notDone), (gpointer) win);
gtk_grid_attach(GTK_GRID(main_calc_box), button, 4, 4, 2, 1);
}
开发者ID:dragonloverlord,项目名称:douchebagulator,代码行数:9,代码来源:buttonRowFour.cpp
示例20: while
double BreckerStrategy::SubsonicOutPress(EndListRef &jun,GasProperty &gas,double dCdA)
{
double dFun =0;
double dGrad = 0;
double dPr=1;
double dStep = 0.1;
BOOL bFlag = TRUE;
while(TRUE)
{
Calc(jun,gas,dCdA,dPr,FALSE,dFun,dGrad);
if(dStep < 0.00001||fabs(dFun)<1E-2)
{
break;
}
if(dFun > 0)
{
if(!bFlag)
{
dStep = dStep / 2;
bFlag = TRUE;
}
dPr = dPr - dStep;
}
else
{
if(bFlag)
{
dStep = dStep / 2;
bFlag = FALSE;
}
dPr = dPr + dStep;
}
}
int n=0;
while (n<100)
{
dPr = dPr -dFun/dGrad;
Calc(jun,gas,dCdA,dPr,FALSE,dFun,dGrad);
if(-1E-8<dFun&&dFun<1E-8)
break;
n++;
}
return dPr*gas.GasPress();
}
开发者ID:uesoft,项目名称:AutoPFA,代码行数:44,代码来源:BreckerStrategy.cpp
注:本文中的Calc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论