• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ card函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: card

void	card(char *s, char *p, int type, t_list *tokens)
{
	struct dirent	*f;
	DIR				*ret;
	char			*t;
	int				i;

	if ((i = 0) && s[0] == '/')
		return (card(s + 1, "/", type, tokens));
	if ((ret = opendir(p)) == NULL)
		return ;
	if (((t = ft_strchr(s, '/')) != NULL))
	{
		while ((f = readdir(ret)) != NULL)
		{
			if ((match(f->d_name, ft_strsub(s, 0, t - s))) && (i = 1))
			{
				ft_putchar(p[s - t]);
				if (((p[s - t] != '.' && s[s - t - 1] != '.') &&
					!ft_strcmp(f->d_name, "..")) || end_point(f->d_name))
					continue ;
				card(t + 1, ft_strjoin(p, f->d_name), type, tokens);
			}
		}
	}
	i = (i == 0) ? card2(s, p, type, tokens) : i;
	closedir(ret);
}
开发者ID:Fingalar,项目名称:MyOwnProjects,代码行数:28,代码来源:newcard.c


示例2: copy

/*
 * Create the file n and copy from file descriptor f.
 */
static void
copy(int f, char *n)
{
	int fd, i, nr, nc;
	char buf[BUFSIZ];

	if (format == 'p')
		card('T', title ? title : n);
	for (i = 0; i < ncopies; i++)
		card(format, &dfname[inchar-2]);
	card('U', &dfname[inchar-2]);
	card('N', n);
	fd = nfile(dfname);
	nr = nc = 0;
	while ((i = read(f, buf, sizeof(buf))) > 0) {
		if (write(fd, buf, i) != i) {
			warn("%s", n);
			break;
		}
		nc += i;
		if (nc >= sizeof(buf)) {
			nc -= sizeof(buf);
			nr++;
			if (MX > 0 && nr > MX) {
				warnx("%s: copy file is too large", n);
				break;
			}
		}
	}
	(void)close(fd);
	if (nc == 0 && nr == 0) 
		warnx("%s: empty input file", f ? n : "stdin");
	else
		nact++;
}
开发者ID:SylvestreG,项目名称:bitrig,代码行数:38,代码来源:lpr.c


示例3: wild_card

void	wild_card(char *line, t_list *tokens)
{
	int		type;

	if (line[ft_strlen(line) - 1] == '/')
		type = 1;
	else
		type = 2;
	if (line[0] == '.' && line[1] && line[1] == '/')
	{
		opendir("./");
		card(line + 2, "./", type, tokens);
	}
	if (line[0] == '.' && line[1] && line[1] == '.' && line[2]
			&& line[2] == '/')
	{
		opendir("../");
		card(line + 3, "../", type, tokens);
	}
	else if (line[0] == '/')
	{
		opendir("/");
		card(line + 1, "/", type, tokens);
	}
	else if ((type = 3))
		card(line, "./", type, tokens);
}
开发者ID:Fingalar,项目名称:MyOwnProjects,代码行数:27,代码来源:newcard.c


示例4: printf

void KMenuTab::mouseReleaseEvent(QMouseEvent *e)
{
	printf("KMenuTab::mouseReleaseEvent()\n");
	qApp->setGlobalMouseTracking(false);
	setMouseTracking(false);

	_mouseTrackerTimer.stop();

	if (e->button() == Qt::LeftButton && !_dragger.tracking() && !_animating && !mDontOpenCard)
	{
		if (card()->isOpen())
		{
			card()->shut(true);
		}
		else
		{
			card()->open(true);
		}
	}

	if (e->button() == Qt::RightButton)
	{
		showContextMenu();
	}
	_dragger.done();
}
开发者ID:BackupTheBerlios,项目名称:slicker-svn,代码行数:26,代码来源:kmenutab.cpp


示例5: drm_mode_create_dumb

void DumbFramebuffer::Create()
{
	int r;

	const FormatInfo& format_info = format_info_array.at(m_format);

	m_num_planes = format_info.num_planes;

	for (int i = 0; i < format_info.num_planes; ++i) {
		const FormatPlaneInfo& pi = format_info.planes[i];
		FramebufferPlane& plane = m_planes[i];

		/* create dumb buffer */
		struct drm_mode_create_dumb creq = drm_mode_create_dumb();
		creq.width = width() / pi.xsub;
		creq.height = height() / pi.ysub;
		creq.bpp = pi.bitspp;
		r = drmIoctl(card().fd(), DRM_IOCTL_MODE_CREATE_DUMB, &creq);
		if (r)
			throw std::invalid_argument("foo");

		plane.handle = creq.handle;
		plane.stride = creq.pitch;
		plane.size = creq.height * creq.pitch;

		/*
		printf("buf %d: %dx%d, bitspp %d, stride %d, size %d\n",
			i, creq.width, creq.height, pi->bitspp, plane->stride, plane->size);
		*/

		/* prepare buffer for memory mapping */
		struct drm_mode_map_dumb mreq = drm_mode_map_dumb();
		mreq.handle = plane.handle;
		r = drmIoctl(card().fd(), DRM_IOCTL_MODE_MAP_DUMB, &mreq);
		if (r)
			throw std::invalid_argument("foo");

		/* perform actual memory mapping */
		m_planes[i].map = (uint8_t *)mmap(0, plane.size, PROT_READ | PROT_WRITE, MAP_SHARED,
						  card().fd(), mreq.offset);
		if (plane.map == MAP_FAILED)
			throw std::invalid_argument("foo");

		/* clear the framebuffer to 0 */
		memset(plane.map, 0, plane.size);
	}

	/* create framebuffer object for the dumb-buffer */
	uint32_t bo_handles[4] = { m_planes[0].handle, m_planes[1].handle };
	uint32_t pitches[4] = { m_planes[0].stride, m_planes[1].stride };
	uint32_t offsets[4] = { 0 };
	uint32_t id;
	r = drmModeAddFB2(card().fd(), width(), height(), (uint32_t)format(),
			  bo_handles, pitches, offsets, &id, 0);
	if (r)
		throw std::invalid_argument("foo");

	set_id(id);
}
开发者ID:ujfalusi,项目名称:kmsxx,代码行数:59,代码来源:dumbframebuffer.cpp


示例6: findBaseSet

//! @brief How many levels in the "base-set" for that ciphertext
long Ctxt::findBaseLevel() const 
{
  IndexSet s;
  findBaseSet(s);
  if (context.containsSmallPrime()) {
    if (s.contains(context.ctxtPrimes.first()))
      return 2*card(s) -1; // 1st prime is half size
    else
      return 2*card(s);
  }
  else return card(s);     // one prime per level
}
开发者ID:Kverma517,项目名称:HElib,代码行数:13,代码来源:Ctxt.cpp


示例7: init_cards

void deck_of_cards::init_cards() {
    for (unsigned int i = 0; i < number_of_suits; i++) {
        for (unsigned int j = 0; j < number_of_ranks; j++) {
            cards.push_back(card(static_cast<suit_t>(i), static_cast<rank_t>(j+1)));
        }
    }
}
开发者ID:geraldstanje,项目名称:deck_of_cards,代码行数:7,代码来源:deck.cpp


示例8: seat

void Manager::handlePutBottom(ValueEvent<PutBottomMsg>* e)
{
    auto v = e->value();
    Seat* s = seat(v.seat());
    std::vector<Card> bottom;
    for (auto c : v.card()) {
        bottom.push_back(c);
    }
    if (mStatus != PickBottom) {
        notifyPutBottomFail(s, bottom, ErrorCode::StatusError);
        return;
    }
    if (s->seat() != mDealer) {
        notifyPutBottomFail(s, bottom, ErrorCode::PerformerError);
        return;
    }
    try {
        mChecker->putBottom(s, bottom);
        mRes.putBottom(bottom);
        mStatus = BottomFinish;
        notifyFixBottom(s, bottom, FixBottomReason::Normal);
    } catch (Exception& e) {
        notifyPutBottomFail(s, bottom, e.code());
    }
}
开发者ID:fortrue,项目名称:ssj,代码行数:25,代码来源:Manager.cpp


示例9: mCardsLeft

Deck::Deck() : mCardsLeft(52) {
	for (unsigned int i(0); i < SUIT_MAX; ++i)
		for (unsigned int j(0); j < RANK_MAX; ++j) {
				Card card(i, j, j);
				mDeck.push_back(card);
		}
}
开发者ID:Plogbilen,项目名称:BlackJack,代码行数:7,代码来源:Deck.cpp


示例10: reset

void deck::reset(){
	cards.clear();
	for(int rank = card::ACE; rank <= card::KING; rank++)
		for(int suit = card::SPADES; suit <= card::CLUBS; suit++){
			cards.push_back(card(card::cardRank(rank), card::cardSuit(suit)));
		}
}
开发者ID:usmanshahid,项目名称:solitaire,代码行数:7,代码来源:deck.cpp


示例11: toPoly

void SingleCRT::toPoly(ZZX& poly, const IndexSet& s) const
{
  IndexSet s1 = map.getIndexSet() & s;

  if (card(s1) == 0) {
    clear(poly);
    return;
  }

  ZZ p = to_ZZ(context.ithPrime(s1.first()));  // the first modulus

  poly = map[s1.first()];  // Get poly modulo the first prime

  vec_ZZ& vp = poly.rep;

  // ensure that coeficient vector is of size phi(m) with entries in [-p/2,p/2]
  long phim = context.zMstar.phiM();
  long vpLength = vp.length();
  if (vpLength<phim) { // just in case of leading zeros in poly
    vp.SetLength(phim);
    for (long j=vpLength; j<phim; j++) vp[j]=0;
  }
  ZZ p_over_2 = p/2;
  for (long j=0; j<phim; j++) if (vp[j] > p_over_2) vp[j] -= p;

  // do incremental integer CRT for other levels  
  for (long i = s1.next(s1.first()); i <= s1.last(); i = s1.next(i)) {
    long q = context.ithPrime(i);       // the next modulus

    // CRT the coefficient vectors of poly and current
    intVecCRT(vp, p, map[i].rep, q);    // defined in the module NumbTh
    p *= q;     // update the modulus
  }
  poly.normalize(); // need to call this after we work on the coeffs
}
开发者ID:dwu4,项目名称:fhe-si,代码行数:35,代码来源:SingleCRT.cpp


示例12: card

void DrmObject::print_props() const
{
	for (auto it = m_prop_values.begin(); it != m_prop_values.end(); ++it) {
		cout << "\t" << card().get_prop(it->first)->name() <<
			" = " << it->second << endl;
	}
}
开发者ID:ujfalusi,项目名称:kmsxx,代码行数:7,代码来源:drmobject.cpp


示例13: k_power_set_char

/** 
 * Converts the k power set of X in the "natural" order to char**
 * Function is suboptimal, partly because of SET_MAX
 *
 * @param n cardinality of X
 * @param sb the length of k_power_set
 * @param k_power_set array representing the k power set of X
 * @param subset converted k power set 
 * @author Michel Grabisch and Ivan Kojadinovic  
 */
void k_power_set_char(int *n, int *sb, int *k_power_set, char **subset) {

  subset[0] = (char *) R_alloc(3, sizeof(char));
  sprintf(subset[0],"{}");

  for(int i=1; i<*sb; i++) {
    int j, x[32];

    for(j=0; j<*n; j++)
      x[j]=0;

    binary2subset(*n, k_power_set[i], x);

    subset[i] = (char *) R_alloc(SET_MAX * (*n), sizeof(char));
    sprintf(subset[i],"{%d",x[0]+1);

    for(j=1; j < card(k_power_set[i]); j++) {
      char string[255];
      sprintf(string,",%d", x[j]+1);
      strcat(subset[i],string);
    }

    strcat(subset[i],"}");
  }
}
开发者ID:cran,项目名称:copula,代码行数:35,代码来源:set_utils.c


示例14: remove

void IndexSet::remove(const IndexSet& s) {
  if (this == &s) { clear(); return; }
  if (s.card() == 0) return;
  if (card() == 0) return;

  for (long i = s.first(); i <= s.last(); i = s.next(i)) remove(i);
  // NOTE: traversal order should not matter here
}
开发者ID:deepinit-arek,项目名称:HElib,代码行数:8,代码来源:IndexSet.cpp


示例15: retain

void IndexSet::retain(const IndexSet& s) {
  if (this == &s) return;
  if (s.card() == 0) { clear(); return; }
  if (card() == 0) return;

  for (long i = first(); i <= last(); i = next(i)) {
    if (!s.contains(i)) remove(i);
  }
}
开发者ID:deepinit-arek,项目名称:HElib,代码行数:9,代码来源:IndexSet.cpp


示例16: drmModeRmFB

void DumbFramebuffer::Destroy()
{
	/* delete framebuffer */
	drmModeRmFB(card().fd(), id());

	for (uint i = 0; i < m_num_planes; ++i) {
		FramebufferPlane& plane = m_planes[i];

		/* unmap buffer */
		munmap(plane.map, plane.size);

		/* delete dumb buffer */
		struct drm_mode_destroy_dumb dreq = drm_mode_destroy_dumb();
		dreq.handle = plane.handle;
		drmIoctl(card().fd(), DRM_IOCTL_MODE_DESTROY_DUMB, &dreq);

	}
}
开发者ID:ujfalusi,项目名称:kmsxx,代码行数:18,代码来源:dumbframebuffer.cpp


示例17: card

void Deck::mRefill() {
	std::cout << "Out of cards! Shuffling the deck...." << std::endl;
	for (unsigned int i(0); i < SUIT_MAX; ++i)
		for (unsigned int j(0); j < RANK_MAX; ++j) {
			Card card(i, j, j);
			mDeck.push_back(card);
		}
	mCardsLeft = 52;
}
开发者ID:Plogbilen,项目名称:BlackJack,代码行数:9,代码来源:Deck.cpp


示例18: love

void love(void)
{
    int n;

    while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount)
	continue;
    if (wordtype[wordnumber] == NOUNS) {
	if ((testbit(location[position].objects, BATHGOD) || testbit(location[position].objects, NORMGOD)) && wordvalue[wordnumber] == NORMGOD) {
	    if (loved) {
		printf("Loved.\n");
		return;
	    }
	    if (godready >= 2) {
		puts("She cuddles up to you, and her mouth starts to work:\n'That was my sister's amulet. The lovely goddess, Purl, was she. The Empire\ncaptured her just after the Darkness came. My other sister, Vert, was killed\nby the Dark Lord himself. He took her amulet and warped its power.\nYour quest was foretold by my father before he died, but to get the Dark Lord's\namulet you must use cunning and skill. I will leave you my amulet,");
		puts("which you may use as you wish. As for me, I am the last goddess of the\nwaters. My father was the Island King, and the rule is rightfully mine.'\n\nShe pulls the throne out into a large bed.");
		power++;
		pleasure += 15;
		ego++;
		if (card(injuries, NUMOFINJURIES)) {
		    puts("Her kisses revive you; your wounds are healed.\n");
		    for (n = 0; n < NUMOFINJURIES; n++)
			injuries[n] = 0;
		    WEIGHT = MAXWEIGHT;
		    CUMBER = MAXCUMBER;
		}
		printf("Goddess:\n");
		if (!loved)
		    setbit(location[position].objects, MEDALION);
		loved = 1;
		ourtime += 10;
		printf("Loved.\n");
		zzz();
		return;
	    } else {
		puts("You wish!");
		return;
	    }
	}
	if (testbit(location[position].objects, wordvalue[wordnumber])) {
	    if (wordvalue[wordnumber] == NATIVE) {
		puts("The girl peels off her sarong and indulges you.");
		power++;
		pleasure += 5;
		printf("Girl:\n");
		ourtime += 10;
		printf("Loved.\n");
		zzz();
	    }
	    if (wordvalue[wordnumber] == MAN || wordvalue[wordnumber] == BODY || wordvalue[wordnumber] == ELF || wordvalue[wordnumber] == TIMER)
		puts("Kinky!");
	    else
		puts("It doesn't seem to work.");
	} else
	    puts("Where's your lover?");
    } else
	puts("It doesn't seem to work.");
}
开发者ID:msharov,项目名称:bsd-games,代码行数:57,代码来源:command5.c


示例19: disjointFrom

bool IndexSet::disjointFrom(const IndexSet& s) const
{
  // quick tests for some common cases
  if (card() == 0 || s.card() == 0
      || last() < s.first() || s.last() < first()) return true;

  for (long i = s.first(); i <= s.last(); i = s.next(i))
    if (contains(i)) return false;
  return true;
}
开发者ID:deepinit-arek,项目名称:HElib,代码行数:10,代码来源:IndexSet.cpp


示例20: desk_

solution::solution() : desk_()
{
    suit suits[] = { suit::Clubs, suit::Diamonds, suit::Hearts, suit::Spades };
    rank ranks[] = { rank::_2, rank::_3, rank::_4, rank::_5, rank::_6, rank::_7, rank::_8, rank::_9, rank::T, rank::J, rank::Q, rank::K, rank::A };
    desk_.reserve(52);
    std::for_each(suits, suits + 4, [&](const suit& s) {
        std::for_each(ranks, ranks + 13, [&](const rank& r) {
            desk_.push_back(card(r, s));
        });
    });
}
开发者ID:azakrytnoi,项目名称:uva,代码行数:11,代码来源:u10205.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cardAcmd函数代码示例发布时间:2022-05-30
下一篇:
C++ car函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap