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


C++ d2函数代码示例

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


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


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