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

C++ d2函数代码示例

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

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



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

示例1: main

int main(int argc, const char *argv[]) {
    Date d1;
    Date d2("February", 14, 1952);

    d1.printDayYear();
    printf("\n");
    d1.printShort();
    printf("\n");
    d1.printLong();
    printf("\n\n");

    d2.printDayYear();
    printf("\n");
    d2.printShort();
    printf("\n");
    d2.printLong();
    std::cout << std::endl;

    return 0;
}
开发者ID:siidney,项目名称:Cpp-How-To-Program-9E,代码行数:20,代码来源:ex_1006.cpp


示例2: SegmentationChangeIndexAutoTest

    bool SegmentationChangeIndexAutoTest(int width, int height, const FuncCI & f1, const FuncCI & f2)
    {
        bool result = true;

        TEST_LOG_SS(Info, "Test " << f1.description << " & " << f2.description << " for size [" << width << "," << height << "].");

        const uint8_t oldIndex = 3, newIndex = 2;
        View s(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        View d1(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        View d2(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        FillRandomMask(s, oldIndex);

        TEST_EXECUTE_AT_LEAST_MIN_TIME(f1.Call(s, oldIndex, newIndex, d1));

        TEST_EXECUTE_AT_LEAST_MIN_TIME(f2.Call(s, oldIndex, newIndex, d2));

        result = result && Compare(d1, d2, 0, true, 64);

        return result;
    }
开发者ID:pozdneev,项目名称:Simd,代码行数:20,代码来源:TestSegmentation.cpp


示例3: d2

void SetContainerClass::setFunc()
{
  std::cout << "before:\n\tstd::string string1[n] = { c b c d e f };\n";
  std::string string1[n] = {"c","b","c","d","e","f"};
/*  for(int i = 0; i < 6; i++)
  {
    if(i == 0) { 
      string1[i] = i + 98; 
      continue;
    }
    string1[i] = i + 97;
  }
  */
  std::set<std::string, std::less<std::string> > d1; // old implementing
  std::set<std::string> d2(string1, string1 + n); // new implementing
  std::ostream_iterator<std::string, char> out(std::cout, " ");
  std::cout << "after:\n\tstd::string string1[n] = { ";
  copy(d2.begin(), d2.end(), out);
  std::cout << "};\n";
}
开发者ID:sergeyminsk,项目名称:serega_cpp,代码行数:20,代码来源:setcontainerclass.cpp


示例4: d

void FLDiskCache::clear()
{
  QDir d(AQ_DISKCACHE_DIRPATH);
  if (d.exists()) {
    QStringList lst = d.entryList("*; *.*");
    for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it)
      d.remove(AQ_DISKCACHE_DIRPATH + '/' + (*it));
  }
#ifndef QSDEBUGGER
  QTextCodec *codec = QTextCodec::codecForLocale();
  QString localEncode(codec ? codec->mimeName() : "");
  QString path(AQ_USRHOME + "/.eneboocache/" + localEncode);
  QDir d2(path);
  if (d2.exists()) {
    QStringList lst = d2.entryList("sys*");
    for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it)
      d2.remove(path + '/' + (*it));
  }
#endif
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:20,代码来源:FLDiskCache.cpp


示例5: tst0

static void tst0() {
    std::cout << "--------------------------------\n";    
    imdd_manager m;
    imdd_ref d1(m), d2(m), d3(m), d4(m);
    d1 = m.mk_empty(1);
    d2 = m.mk_empty(1);
    m.insert_dupdt(d1, 10, 20);
    m.insert_dupdt(d1, 31, 50);
    m.insert_dupdt(d2, 1,  5);
    m.insert_dupdt(d2, 11,  13);
    m.mk_product(d1, d2, d4);
    m.mk_product(d4, d2, d4);
    m.mk_product_dupdt(d1, d2);
    std::cout << "d1:\n" << mk_ll_pp(d1, m) << "\n-------\n";
    m.mk_product_dupdt(d1, d2);
    std::cout << "d4:\n" << mk_ll_pp(d4, m) << "\nd1:\n" << mk_ll_pp(d1, m) << "\nd2:\n" << mk_ll_pp(d2, m) << "\n";
    std::cout << d1 << "\n" << d2 << "\n";
    m.mk_product_dupdt(d1, d1);
    std::cout << "d1 X d1:\n" << mk_ll_pp(d1, m) << "\n";
}
开发者ID:Moondee,项目名称:Artemis,代码行数:20,代码来源:imdd.cpp


示例6: ColorFilterAutoTest

	bool ColorFilterAutoTest(View::Format format, int width, int height, const FuncC & f1, const FuncC & f2)
	{
		bool result = true;

		TEST_LOG_SS(Info, "Test " << f1.description << " & " << f2.description << " [" << width << ", " << height << "].");

		View s(width, height, format, NULL, TEST_ALIGN(width));
		FillRandom(s);

		View d1(width, height, format, NULL, TEST_ALIGN(width));
		View d2(width, height, format, NULL, TEST_ALIGN(width));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f1.Call(s, d1));

		TEST_EXECUTE_AT_LEAST_MIN_TIME(f2.Call(s, d2));

		result = result && Compare(d1, d2, 0, true, 32);

		return result;
	}
开发者ID:pozdneev,项目名称:Simd,代码行数:20,代码来源:TestFilter.cpp


示例7: d1

string Parser::getStringBetweenMatched(char cd1, char cd2) {
  string token = "";
  int open_delims = 0;
  string d1(1, cd1);
  string d2(1, cd2);
  nextTokenMustBe(d1);
  while (infile.peek() != cd2 || open_delims != 0) {
    if (infile.peek() == EOF) throw DanglingDelimiterException(filename, line_num, line_pos, d2);
    line_pos++;
    if (infile.peek() == '\n' || infile.peek() == '\f') {
      line_num++;
      line_pos = 1;
    }
    else if (infile.peek() == cd1) open_delims++;
    else if (infile.peek() == cd2) open_delims--;
    token += infile.get();
  }
  nextTokenMustBe(d2);
  return token;
}
开发者ID:fly2mars,项目名称:suAgent,代码行数:20,代码来源:parser.cpp


示例8: StretchGrayDataTest

    bool StretchGrayDataTest(bool create, int width, int height, const Func & f, int stretch)
    {
        bool result = true;

        Data data(f.description);

        std::cout << (create ? "Create" : "Verify") << " test " << f.description << " [" << width << ", " << height << "]." << std::endl;

        const int stretchedWidth = width*stretch;
        const int stretchedHeight = height*stretch;

        View s(width, height, View::Gray8, NULL, TEST_ALIGN(width));

        View d1(stretchedWidth, stretchedHeight, View::Gray8, NULL, TEST_ALIGN(stretchedWidth));
        View d2(stretchedWidth, stretchedHeight, View::Gray8, NULL, TEST_ALIGN(stretchedWidth));

        if(create)
        {
            FillRandom(s);

            TEST_SAVE(s);

            f.Call(s, d1);

            TEST_SAVE(d1);
        }
        else
        {
            TEST_LOAD(s);

            TEST_LOAD(d1);

            f.Call(s, d2);

            TEST_SAVE(d2);

            result = result && Compare(d1, d2, 0, true, 64);
        }

        return result;
    }
开发者ID:nagyist,项目名称:Simd,代码行数:41,代码来源:TestStretchGray.cpp


示例9: d1

unsigned int CDateTime::weekOfYear(int year, unsigned int month, unsigned int day)
{
    if (!isValid(year, month, day))
    {
        return 0;
    }

    CDateTime d1(year, month, day);
    int a = dayOfWeek(year, month, day);
    d1.addDays(4 - a); // Jeudi de cette semaine

    int y1 = d1.getYear();

    CDateTime d2(y1, 1, 4);
    int b = dayOfWeek(y1, 1, 4);
    d2.addDays(1 - b); // Lundi de cette semaine

    int y2 = d2.getYear();

    if (y1 < y2)
    {
        unsigned int a1 = (isLeapYear(y1) ? 366 : 365) - dayOfYear(y1, d1.getMonth(), d1.getDay());
        unsigned int a2 = dayOfYear(y2, d2.getMonth(), d2.getDay());

        return (1 + (a1 + a2) / 7);
    }
    else if (y1 > y2)
    {
        unsigned int a1 = dayOfYear(y1, d1.getMonth(), d1.getDay());
        unsigned int a2 = (isLeapYear(y2) ? 366 : 365) - dayOfYear(y2, d2.getMonth(), d2.getDay());

        return (1 + (a1 + a2) / 7);
    }
    else
    {
        unsigned int a1 = dayOfYear(y1, d1.getMonth(), d1.getDay());
        unsigned int a2 = dayOfYear(y2, d2.getMonth(), d2.getDay());

        return (1 + (a2 > a1 ? a2 - a1 : a1 - a2) / 7);
    }
}
开发者ID:teddy-michel,项目名称:TEngine,代码行数:41,代码来源:CDateTime.cpp


示例10: main

int main() {
    {
        using T0 = hana::tuple<double>;
        using T1 = hana::tuple<int>;
        T0 t0(2.5);
        T1 t1;
        t1 = t0;
        BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t1) == 2);
    }
    {
        using T0 = hana::tuple<double, char>;
        using T1 = hana::tuple<int, int>;
        T0 t0(2.5, 'a');
        T1 t1;
        t1 = t0;
        BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t1) == 2);
        BOOST_HANA_RUNTIME_CHECK(hana::at_c<1>(t1) == int('a'));
    }
    {
        using T0 = hana::tuple<double, char, D>;
        using T1 = hana::tuple<int, int, B>;
        T0 t0(2.5, 'a', D(3));
        T1 t1;
        t1 = t0;
        BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t1) == 2);
        BOOST_HANA_RUNTIME_CHECK(hana::at_c<1>(t1) == int('a'));
        BOOST_HANA_RUNTIME_CHECK(hana::at_c<2>(t1).id_ == 3);
    }
    {
        D d(3);
        D d2(2);
        using T0 = hana::tuple<double, char, D&>;
        using T1 = hana::tuple<int, int, B&>;
        T0 t0(2.5, 'a', d2);
        T1 t1(1.5, 'b', d);
        t1 = t0;
        BOOST_HANA_RUNTIME_CHECK(hana::at_c<0>(t1) == 2);
        BOOST_HANA_RUNTIME_CHECK(hana::at_c<1>(t1) == int('a'));
        BOOST_HANA_RUNTIME_CHECK(hana::at_c<2>(t1).id_ == 2);
    }
}
开发者ID:Ding8222,项目名称:abelkhan,代码行数:41,代码来源:assign.convert_copy.cpp


示例11: TEST

TEST(DictionaryEquality, SimpleValues) {
	AmfDictionary d0(true), d1(true), d2(false);
	d0.insert(AmfInteger(0), AmfString("foo"));
	d1.insert(AmfInteger(0), AmfString("foo"));
	d2.insert(AmfInteger(0), AmfString("foo"));
	EXPECT_EQ(d0, d1);
	EXPECT_NE(d0, d2);

	d0.insert(AmfString("qux"), AmfByteArray(v8 { 0x00 }));
	EXPECT_NE(d0, d1);
	d1.insert(AmfString("qux"), AmfByteArray(v8 { 0x00 }));
	EXPECT_EQ(d0, d1);

	d0.insert(AmfNull(), AmfUndefined());
	d1.insert(AmfUndefined(), AmfNull());
	EXPECT_NE(d0, d1);

	d0.insert(AmfUndefined(), AmfNull());
	d1.insert(AmfNull(), AmfUndefined());
	EXPECT_EQ(d0, d1);
}
开发者ID:richieyan,项目名称:amf-cpp,代码行数:21,代码来源:dictionary.cpp


示例12: BlackScholesPrice

		double BlackScholesPrice(const double stockPrice, const double strikePrice,
			const double expiry, const double volatility, const double interestRate, 
			const double costOfCarry, const OptionType optionType)
		{
			double normalVal1 = NORMALDISTRIBUTIONS::N(d1(stockPrice, strikePrice, expiry, volatility, costOfCarry));
			double normalVal2 = NORMALDISTRIBUTIONS::N(d2(stockPrice, strikePrice, expiry, volatility, costOfCarry));

			switch (optionType)
			{
			case EUROPEANCALL:
				return (stockPrice*normalVal1*exp((costOfCarry - interestRate)*expiry) - strikePrice*normalVal2*exp(-interestRate*expiry));
				break;
			case EUROPEANPUT:
				// N(-d1) = 1 - N(d1) and N(-d2) = 1 - N(d2)
				return (strikePrice*(1 - normalVal2)*exp(-interestRate*expiry) - stockPrice*(1 - normalVal1)*exp((costOfCarry - interestRate)*expiry));
				break;
			default:
				throw EXCEPTIONS::InvalidOptionException(-1);
				break;
			}
		}
开发者ID:mistletoe999,项目名称:cpp-samples,代码行数:21,代码来源:Pricing.cpp


示例13: testDoubleDerived

    void testDoubleDerived() {
      DoubleDerivedVTBL d;
      d.x = 1;
      d.y = 2;
      d.z = 3;
      clang_analyzer_eval(getX(d) == 1); // expected-warning{{TRUE}}
      clang_analyzer_eval(getY(d) == 2); // expected-warning{{TRUE}}
      clang_analyzer_eval(getZ(d) == 3); // expected-warning{{TRUE}}

      Base b(d);
      clang_analyzer_eval(getX(b) == 1); // expected-warning{{TRUE}}

      DerivedVTBL d2(d);
      clang_analyzer_eval(getX(d2) == 1); // expected-warning{{TRUE}}
      clang_analyzer_eval(getY(d2) == 2); // expected-warning{{TRUE}}

      DoubleDerivedVTBL d3(d);
      clang_analyzer_eval(getX(d3) == 1); // expected-warning{{TRUE}}
      clang_analyzer_eval(getY(d3) == 2); // expected-warning{{TRUE}}
      clang_analyzer_eval(getZ(d3) == 3); // expected-warning{{TRUE}}
    }
开发者ID:keryell,项目名称:clang-1,代码行数:21,代码来源:derived-to-base.cpp


示例14: main

int main()
{
	Complex d1(5, 10);
	Complex d2(7, 10);
	Complex d4;

	cout << "d1(5,10)  "<<"d2(7,10)  "<<"d4(0,0)"<<endl;
	
	cout << "d4 = d1" << endl;
	d4 = d1;
	d4.Display();
	cout << "d2 - d1" << endl;
	d4 = d2 - d1;
	d4.Display();
	cout << "d2 + d1" << endl;
	d4 = d2 + d1;
	d4.Display();
	cout << "d4 += d1" << endl;
	d4 += d1;
	d4.Display();
	cout << "d4 -= d1" << endl;
	d4 -= d1;
	d4.Display();
	cout << "d4++" << endl;
	d4++;
	d4.Display();
	cout << "++d4" << endl;
	++d4;
	d4.Display();
	cout << "d4++" << endl;
	d4--;
	d4.Display();
	cout << "--d4" << endl;
	--d4;
	cout << "d4 == d1" << endl;
	cout << (d4 == d1) << endl;

	system("pause");
	return 0;
}
开发者ID:jaeee,项目名称:jaee-Demo,代码行数:40,代码来源:Complex.cpp


示例15: main

main()
{
   Punct x1(10, 10), x2(100, 200);
   Dreptunghi d1(x1, x2), d2(10, 20, 14, 50);

   clrscr();

   d1.List();
   getch();
   cout<<'\n';
   d2.List();
   getch();
   cout<<'\n';
   if (d1 == d2)
      cout<<"d1 = d2";
   else
      cout<<"d1 != d2";
   getch();
   cout<<'\n';
   cout<<d1.Lung_lat1()<<' '<<d1.Lung_lat2();
   getch();
   cout<<'\n';
   cout<<d2.Lung_lat1()<<' '<<d2.Lung_lat2();
   getch();
   cout<<'\n';
   cout<<"Perimetrul d1: "<<d1.Perimetru();
   getch();
   cout<<'\n';
   cout<<"Perimetrul d2: "<<d2.Perimetru();
   getch();
   cout<<'\n';
   cout<<"d1, colt stanga sus : "<<d1.Colt_st_sus();
   getch();
   cout<<'\n';
   cout<<"d1, colt dreapta jos : "<<d1.Colt_dr_jos();
   getch();
   cout<<'\n';

   return 0;
}
开发者ID:bdumitriu,项目名称:playground,代码行数:40,代码来源:usedrept.cpp


示例16: ofSimplifyContour

//-------------------------------------------------------------------
// needs simplifyDP which is above
static vector <ofPoint> ofSimplifyContour(vector <ofPoint> &V, float tol){
	int n = V.size();

	vector <ofPoint> sV;
	sV.assign(n, ofPoint());

    int    i, k, m, pv;            // misc counters
    float  tol2 = tol * tol;       // tolerance squared
    ofPoint * vt = new ofPoint[n];
	int * mk = new int[n];

	memset(mk, 0, sizeof(int) * n );

    // STAGE 1.  Vertex Reduction within tolerance of prior vertex cluster
    vt[0] = V[0];              // start at the beginning
    for (i=k=1, pv=0; i<n; i++) {
        if (d2(V[i], V[pv]) < tol2) continue;

        vt[k++] = V[i];
        pv = i;
    }
    if (pv < n-1) vt[k++] = V[n-1];      // finish at the end

    // STAGE 2.  Douglas-Peucker polyline simplification
    mk[0] = mk[k-1] = 1;       // mark the first and last vertices
    simplifyDP( tol, vt, 0, k-1, mk );

    // copy marked vertices to the output simplified polyline
    for (i=m=0; i<k; i++) {
        if (mk[i]) sV[m++] = vt[i];
    }

	//get rid of the unused points
	if( m < (int)sV.size() ) sV.erase( sV.begin()+m, sV.end() );

	delete [] vt;
	delete [] mk;

	return sV;
}
开发者ID:jorik041,项目名称:openFrameworks,代码行数:42,代码来源:ofTrueTypeFont.cpp


示例17: SegmentationChangeIndexDataTest

    bool SegmentationChangeIndexDataTest(bool create, int width, int height, const FuncCI & f)
    {
        bool result = true;

        Data data(f.description);

        TEST_LOG_SS(Info, (create ? "Create" : "Verify") << " test " << f.description << " [" << width << ", " << height << "].");

        View s(width, height, View::Gray8, NULL, TEST_ALIGN(width));

        View d1(width, height, View::Gray8, NULL, TEST_ALIGN(width));
        View d2(width, height, View::Gray8, NULL, TEST_ALIGN(width));

        const uint8_t oldIndex = 3, newIndex = 2;

        if(create)
        {
            FillRandomMask(s, oldIndex);

            TEST_SAVE(s);

            f.Call(s, oldIndex, newIndex, d1);

            TEST_SAVE(d1);
        }
        else
        {
            TEST_LOAD(s);

            TEST_LOAD(d1);

            f.Call(s, oldIndex, newIndex, d2);

            TEST_SAVE(d2);

            result = result && Compare(d1, d2, 0, true, 64);
        }

        return result;
    }
开发者ID:pozdneev,项目名称:Simd,代码行数:40,代码来源:TestSegmentation.cpp


示例18: TestQueue

void TestQueue( const Allocator& a )
{
    // A queue can be made out of deque or list
    typedef std::deque< typename Allocator::value_type, Allocator > Deque;
    typedef std::list< typename Allocator::value_type, Allocator > List;

    typedef std::queue< typename Allocator::value_type, Deque > DQueue;
    typedef std::queue< typename Allocator::value_type, List > LQueue;

    DQueue d1( Policy< Allocator >::template GetDefaultAdapter< DQueue, Deque >( a ) );
    DQueue d2( Policy< Allocator >::template GetCopiedAdapter< DQueue, Deque >( a ) );
    LQueue l1( Policy< Allocator >::template GetDefaultAdapter< LQueue, List >( a ) );
    LQueue l2( Policy< Allocator >::template GetCopiedAdapter< LQueue, List >( a ) );

    // Test deque queues
    TestQueue( a, d1 );
    TestQueue( a, d2 );

    // Test list queues
    TestQueue( a, l1 );
    TestQueue( a, l2 );
}
开发者ID:RhysU,项目名称:suzerain,代码行数:22,代码来源:StlAllocatorTestContainer.hpp


示例19: operator

  result_type operator()(first_argument_type row,
                         second_argument_type r) const
  {
	  draw_north_wall d1;
	  pair_int p1(0,*r);
	  for (maze_row::walls::const_iterator cit = row->north_walls.begin();
	       cit != row->north_walls.end(); ++cit)
	  {
		  d1(*cit, &p1);
	  }

	  draw_east_wall d2;
	  pair_int p2(0,*r);
	  for (maze_row::walls::const_iterator cit = row->east_walls.begin();
	       cit != row->east_walls.end(); ++cit)
	  {
		  d2(*cit, &p2);
	  }
    (*r)++;

    return (0);
  }
开发者ID:HelstVadsom,项目名称:amazing-maze,代码行数:22,代码来源:Maze1.cpp


示例20: TestPriorityQueue

void TestPriorityQueue( const Allocator& a )
{
    // A priority queue can be made out of vector or deque
    typedef std::vector< typename Allocator::value_type, Allocator > Vector;
    typedef std::deque< typename Allocator::value_type, Allocator > Deque;

    typedef std::priority_queue< typename Allocator::value_type, Vector > VQueue;
    typedef std::priority_queue< typename Allocator::value_type, Deque > DQueue;

    VQueue v1( Policy< Allocator >::template GetDefaultPriorityQueue< VQueue, Vector >( a ) );
    VQueue v2( Policy< Allocator >::template GetCopiedPriorityQueue< VQueue, Vector >( a ) );
    DQueue d1( Policy< Allocator >::template GetDefaultPriorityQueue< DQueue, Deque >( a ) );
    DQueue d2( Policy< Allocator >::template GetCopiedPriorityQueue< DQueue, Deque >( a ) );

    // Test vector queues
    TestPriorityQueue( a, v1 );
    TestPriorityQueue( a, v2 );

    // Test deque queues
    TestPriorityQueue( a, d1 );
    TestPriorityQueue( a, d2 );
}
开发者ID:RhysU,项目名称:suzerain,代码行数:22,代码来源:StlAllocatorTestContainer.hpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ d2i_ASN1_INTEGER函数代码示例发布时间:2022-05-30
下一篇:
C++ d1函数代码示例发布时间: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