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


C++ ed函数代码示例

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


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

示例1: fancy_bce_erases

/*
 * Clear around the box for fancy_bce_test().
 */
static void
fancy_bce_erases(BOX *box)
{
  int i;
  int first;
  int limit;

  cup(box->top - 1, min_cols / 2);
  ed(1);        /* clear from home to cursor */
  cuf(1);
  el(0);        /* clear from cursor to end of line */

  cup(box->bottom + 1, min_cols / 2);
  ed(0);        /* clear from cursor to end */
  cub(1);
  el(1);        /* clear to beginning of line */

  for (i = box->top; i <= box->bottom; i++) {
    cup(i, box->left - 1);
    el(1);
    cup(i, box->right + 1);
    limit = min_cols - box->right;
    first = i + 1 - box->top;
    if (first > limit)
      first = limit;
    dch(first);
    limit -= first;
    if (limit > 0)
      ech(limit);
  }
}
开发者ID:Brybry,项目名称:wTerm,代码行数:34,代码来源:color.c

示例2: eval_stress

void eval_stress(double *x, double *coord,
        int *ndim, int *edim, int *nobs, 
        int *samplesize,double *stress) 
{
    int i;
    double dab,simab;
    int a = 0; int b = 0;
    long double denom = 0.0;
    long double numer = 0.0;

    GetRNGstate();
    for (i = 0; i < *samplesize; i++)
      {
        get_indices(*nobs, &a, &b);

        dab = ed(x,a,b,*edim,*nobs);
        simab = ed(coord,a,b,*ndim,*nobs);

        denom += simab;
        numer += (dab - simab) * (dab - simab) / simab;
      }
    *stress = (double) (numer/denom);
    PutRNGstate();
    return;
}
开发者ID:4ppasala,项目名称:cdkr,代码行数:25,代码来源:spe.c

示例3: main

int main(){
    scanf("%d%d",&N,&Q);
    for(int i=0;i<N;++i){
        ll a,b,c;
        scanf("%lld%lld%lld",&a,&b,&c);
        a=rev(a),b=rev(b);
        evts.emplace_back(st(a)+1,st(b)+1,ed(b),c);
        evts.emplace_back(ed(a),st(b)+1,ed(b),-c);
    }
    std::sort(all(evts));
    for(int i=0;i<Q;++i){
        ll a,b;
        scanf("%lld%lld",&a,&b);
        qrys.emplace_back(rev(a),rev(b),i);
    }
    std::sort(all(qrys));
    int i=0;
    for(qry &q:qrys){
        while(i<evts.size()&&evts[i].x<=q.x){
            ins(rt,new nd(evts[i].y1,evts[i].v));
            ins(rt,new nd(evts[i].y2,-evts[i].v));
            ++i;
        }
        nd *l=0,*r=0;
        spt(rt,l,r,q.y);
        ans[q.i]=sum(l);
        mrg(rt,l,r);
    }
    for(int i=0;i<Q;printf("%lld\n",ans[i++]));
}
开发者ID:BinAccel,项目名称:competitive-programming,代码行数:30,代码来源:cco17p3.cpp

示例4: ed

int
ed(char * str1, char*str2) {




	return min (ed (str+1, str2)+1, ed(str1, str2+1)+1);


}
开发者ID:deepw,项目名称:FirstRepo,代码行数:10,代码来源:lcs.c

示例5: test_altscrn_1049

static int
test_altscrn_1049(MENU_ARGS)
{
    vt_move(1,1);
    println(the_title);
    vt_move(3,1);
    println("Test private setmode 1049 (to/from alternate screen)");
    vt_move(4,1);
    println("The next screen will be filled with E's down to the prompt.");
    vt_move(5,1);
    println("unless titeInhibit resource is set, or alternate-screen is disabled.");
    vt_move(7,5);
    decsc();
    vt_move(max_lines-2,1);
    holdit(); /* cursor location will be one line down */

    sm("?1049");  /* this saves the cursor location */
    decaln(); /* fill the screen */
    vt_move(max_lines-2,1);
    ed(0);
    holdit();

    rm("?1049");
    decrc();
    check_rc(max_lines-1,1);
    vt_move(4,1);
    el(2);
    println("The original screen should be restored except for this line");
    vt_move(max_lines-2,1);
    return MENU_HOLD;
}
开发者ID:akat1,项目名称:impala,代码行数:31,代码来源:xterm.c

示例6: ed

void ARCodeWidget::OnCodeEditPressed()
{
  auto items = m_code_list->selectedItems();

  if (items.empty())
    return;

  const auto* selected = items[0];

  auto& current_ar = m_ar_codes[m_code_list->row(selected)];

  bool user_defined = current_ar.user_defined;

  ActionReplay::ARCode ar = current_ar;

  CheatCodeEditor ed(this);

  ed.SetARCode(user_defined ? &current_ar : &ar);
  ed.exec();

  if (!user_defined)
    m_ar_codes.push_back(ar);

  SaveCodes();
  UpdateList();
}
开发者ID:MikeRavenelle,项目名称:dolphin,代码行数:26,代码来源:ARCodeWidget.cpp

示例7: triangular_distmatrix

int triangular_distmatrix(double* coords, int natoms, int nframes, double co, long* out_mat) {
 
  int i = 0;
  int j = 0;
  int k = 0;

  // Initialize output matrix
  int out_mat_elemsn = natoms*(natoms-1)/2;
  //int* out_mat = (int*) malloc(out_mat_elemsn * sizeof(int));  
  for (i=0; i<out_mat_elemsn; i++) 
    out_mat[i] = 0.0;
  
  int idx_j = 0;
  int idx_k = 0;

  for (i=0; i<nframes; i++) {
    for (j=0; j<natoms; j++) {
      idx_j = i*natoms*3 + j*3;
      for (k=0; k<j; k++) {
	idx_k = i*natoms*3 + k*3;
	//printf("%d %d: %.3f\n", j, k, ed(coords, coords, idx_j, idx_k));
	if (ed(coords, coords, idx_j, idx_k) <= co) {
	  out_mat[sqmI(natoms,j,k)] += 1;
	  out_mat[sqmI(natoms,k,j)] += 1;
	}
      }
    }
  }

  return 1;
}
开发者ID:ELELAB,项目名称:pyinteraph,代码行数:31,代码来源:clibinteract.c

示例8: potential_distances

int potential_distances(double* coords, int nsets, int set_size, int nframes, double* results) {  
  int i = 0;
  int j = 0;
  int k = 0;
  int l = 0;
  int combinations[8] = {0, 2, 0, 3, 1, 2, 1, 3};
  int natoms = nsets*set_size;
  int ncoords = natoms*3;
  int this_i = 0;
  int this_ij = 0;
  
  for (i=0; i<nframes; i++) {
    this_i = i*ncoords;
    for (j=0; j<nsets; j++) {
      this_ij = this_i + j*set_size*3;
      for (k=0; k<8; k+=2) {
	//printf ("%d %d -> %d\n", this_ij/3+combinations[k], this_ij/3+combinations[k+1], l);
	//printf ("%3f %3f %3f vs %3f %3f %3f\n", coords[this_ij+combinations[k]*3], coords[this_ij+combinations[k]*3+1], coords[this_ij+combinations[k]*3+2], coords[this_ij+combinations[k+1]*3], coords[this_ij+combinations[k+1]*3+1], coords[this_ij+combinations[k+1]*3+2]);
	
	//printf("%f\n", results[l]);
	results[l] = ed(coords, coords, this_ij+combinations[k]*3, this_ij+combinations[k+1]*3);
	l++;
      }
    }
  }
  return 1;
}
开发者ID:ELELAB,项目名称:pyinteraph,代码行数:27,代码来源:clibinteract.c

示例9: qDebug

void MainWindow::editMonth(QListWidgetItem * item)
{
    int index = ui->monthList->row(item);
    qDebug(months[index].text().toLatin1());
    EditMonth ed(months[index]);
    int result = ed.exec();
}
开发者ID:yodermk,项目名称:LIbreCalendarCreator,代码行数:7,代码来源:mainwindow.cpp

示例10: main

int main(object me, string file)
{
        if (! SECURITY_D->valid_grant(me, "(apprentice)"))
                return 0;
                
        if (! file) return notify_fail("指令格式:edit <档名>\n");
        
        if (in_edit(me)) return notify_fail("你已经在使用编辑器了。\n");
        
        file = resolve_path(me->query("cwd"), file);

        foreach (object user in users())
        if (file == in_edit(user))
                return notify_fail(HIM "共享冲突:" + user->name(1) + HIM "(" + 
                        capitalize(user->query("id")) + ")" + 
                        HIM "正在编辑该文件(" + file + ")。\n" NOR);

        printf("编辑文件:%s\n", file);
        CHANNEL_D->do_channel(this_object(), "sys",
                sprintf("%s(%s)正在编辑文件(%s)。",
                me->name(1),
                capitalize(me->query("id")),
                file));
                
        seteuid(geteuid(me));
        me->set("cwf", file);
        SECURITY_D->backup_file(file);
        ed(file); 
        
        log_file("static/edit", sprintf("%s %-9s edit %s from %s.\n",
                                        log_time(),
                                        geteuid(me), file,
                                        query_ip_name(me)));
        return 1;
}
开发者ID:mudchina,项目名称:nitan3,代码行数:35,代码来源:edit.c

示例11: test_altscrn_47

static int
test_altscrn_47(MENU_ARGS)
{
    vt_move(1,1);
    println(the_title);
    vt_move(3,1);
    println("Test private setmode 47 (to/from alternate screen)");
    vt_move(4,1);
    println("The next screen will be filled with E's down to the prompt.");
    vt_move(7,5);
    decsc();
    vt_move(max_lines-2,1);
    holdit();

    sm("?47");
    decaln(); /* fill the screen */
    vt_move(15,7);
    decsc();
    vt_move(max_lines-2,1);
    ed(0);
    holdit();

    rm("?47");
    decrc();
    check_rc(7,5);
    vt_move(4,1);
    el(2);
    println("The original screen should be restored except for this line.");
    vt_move(max_lines-2,1);
    return MENU_HOLD;
}
开发者ID:akat1,项目名称:impala,代码行数:31,代码来源:xterm.c

示例12: SmallExplosion

void NixonPowerCell::hit(const df::EventCollision *p_collision_event) {
	if ((p_collision_event->getObject1()->getType() == "PlayerGunShot") ||
		(p_collision_event->getObject2()->getType() == "PlayerGunShot")) {
		if (!was_hit) {
			health--;
			was_hit = true;
			has_flashed = false;
			hit_countdown = hit_slowdown;
		}
	}

	// If PlayerCannonShot or Player, create explosion and delete rock
	if ((p_collision_event->getObject1()->getType() == "PlayerCannonShot") ||
		(p_collision_event->getObject2()->getType() == "PlayerCannonShot") ||
		health <= 0) {
		df::WorldManager &world_manager = df::WorldManager::getInstance();

		// Create an explosion.
		SmallExplosion *p_explosion = new SmallExplosion(getPosition());

		// Play "explode" sound

		//Send Points for deletion
		df::EventView ev(SCORE_STRING, NIXONPOWERCELL_POINTS, true);
		world_manager.onEvent(&ev);
		
		//Send death event
		EventFootSoldierDeath ed(this);
		world_manager.onEvent(&ed);

		//Delete this object
		df::WorldManager::getInstance().markForDelete(this);
	}
}
开发者ID:johnn134,项目名称:TheTankHeardAroundTheWorld,代码行数:34,代码来源:NixonPowerCell.cpp

示例13: rexp

double rexp(double mean, boost::mt19937& rng) {
    double lambda = 1.0 / mean;
    boost::exponential_distribution<> ed(lambda);
    boost::variate_generator<boost::mt19937&, boost::exponential_distribution<> > var_exp(rng, ed);
    double val = var_exp();
    return val;
}
开发者ID:tfussell,项目名称:Pneumo-ABM,代码行数:7,代码来源:Rdraws.cpp

示例14: DelayedObsoleteChecks

void
Bindable::DelayedCheckManager::CompleteDelayedObsoleteChecks()
{
    CDoubleListForwardIter<DelayedObsoleteCheckInfo> DelayedObsoleteChecks(&m_ListOfDelayedObsoleteChecks);

    while (DelayedObsoleteCheckInfo *DelayedCheck = DelayedObsoleteChecks.Next())
    {
        bool performObsoleteCheck = true;

        if (DelayedCheck->m_ContextOfSymbolUsage !=NULL)
        {

            performObsoleteCheck = 
                !ObsoleteChecker::IsObsoleteOrHasObsoleteContainer(DelayedCheck->m_ContextOfSymbolUsage, true);
        }
            
        if (performObsoleteCheck)
        {
            ObsoleteChecker::CheckObsoleteAfterEnsuringAttributesAre----ed(
                DelayedCheck->m_PossibleObsoleteSymbol,
                &DelayedCheck->m_LocationOfSymbolUsage,
                m_ContainerContext,
                DelayedCheck->m_ErrorLogToReportObsoleteError);
        }
    }
}
开发者ID:JianwenSun,项目名称:cc,代码行数:26,代码来源:binderutilities.cpp

示例15: ed

void RS_ActionDrawEllipseFociPoint::trigger() {
    RS_PreviewActionInterface::trigger();


    RS_EllipseData ed(center,
                      major*d,
                      sqrt(d*d-c*c)/d,
                      0., 0.,false);
    RS_Ellipse* ellipse = new RS_Ellipse(container, ed);
    ellipse->setLayerToActive();
    ellipse->setPenToActive();

    container->addEntity(ellipse);

    // upd. undo list:
    if (document!=NULL) {
        document->startUndoCycle();
        document->addUndoable(ellipse);
        document->endUndoCycle();
    }

//    RS_Vector rz = graphicView->getRelativeZero();
    graphicView->moveRelativeZero(ellipse->getCenter());
    graphicView->redraw(RS2::RedrawDrawing);
    drawSnapper();

    setStatus(SetFocus1);

    RS_DEBUG->print("RS_ActionDrawEllipseFociPoint::trigger():"
                    " entity added: %d", ellipse->getId());
}
开发者ID:chenchizhao,项目名称:LibreCAD,代码行数:31,代码来源:rs_actiondrawellipsefocipoint.cpp


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