コード例 #1
0
ファイル: main.cpp プロジェクト: ethelle/examples
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Calc calc;
    calc.show();
    return app.exec();
}
コード例 #2
0
ファイル: CalcBitDigits2.cpp プロジェクト: dubenju/javay
/*
 * メイン処理
 */
int main()
{
    try
    {
        // 計算クラスインスタンス化
        Calc objCalc;

        // 計算 ( 加算 )
        objCalc.calcAdd();

        // 計算 ( 減算 )
        objCalc.calcSub();

        // 計算 ( 乗算 )
        objCalc.calcMul();

        // 計算 ( 除算 )
        objCalc.calcDiv();
    }
    catch (...) {
        cout << "例外発生!" << endl;
        return -1;
    }

    // 正常終了
    return 0;
}
コード例 #3
0
ファイル: thisPointer.cpp プロジェクト: mohitsh/cpp
int main()
{

	Calc calc;
	calc.Add(5).Sub(3).Mul(4);
	std::cout << calc.getValue() << "\n";

}
コード例 #4
0
ファイル: main.cpp プロジェクト: komh/qtex
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Calc w;
    w.show();

    return a.exec();
}
コード例 #5
0
ファイル: App.cpp プロジェクト: romanlum/StudyCode
int main() {

   Calc* c = new Calc();
   c->Add(3);
   c->Add(4);
   c->Add(9);
   cout << "sum: " << c->GetSum();
   delete c;
}
コード例 #6
0
ファイル: oogo_c.cpp プロジェクト: adrianuswarmenhoven/oogo
int oogo_store_calc(calc_c c, const char* filter, const char* url) {
    try {
        Calc *calc = (Calc*) c.calc;
        calc->store(string(filter), string(url));
        return 0;
    } catch (com::sun::star::uno::Exception &e) {
        oogo_ebuf_e(e);
        return 1;
    }
}
コード例 #7
0
ファイル: main.cpp プロジェクト: avwhite/ismCalc
int main(int arc, char* argv[])
{
    Calc c;
    optDouble res = c.calc(argv[1]);
    if(res.second == true)
        std::cout << c.calc(argv[1]).first << std::endl;
    else
        std::cout << "ERROR" << std::endl;

    return 0;
}
コード例 #8
0
ファイル: b_k.cpp プロジェクト: filaPro/my
void *thread(void *pManager){
	Manager *mgr = (Manager*)pManager;
 	do{
		Calc *c = mgr->give_else();
 		if(c != NULL){
			c->func(c);
			c->m->i_am_done(c);
		}else
			break;
	}while(1);
	return NULL;
}   
コード例 #9
0
ファイル: a.cpp プロジェクト: filaPro/my
void *thread(void *parasha){
	Manager *mgr = (Manager*)parasha;
	do{
		Calc *c = mgr->day_eshe();
		if(c != NULL){
			c->func(c);
			c->m->i_am_done(c);
		}else
			break;
	}while(1);

	return NULL;
}
コード例 #10
0
ファイル: oogo_c.cpp プロジェクト: adrianuswarmenhoven/oogo
sheet_c oogo_sheet_i(calc_c c, int idx) {
    sheet_c sheet;
    try {
        Calc *calc = (Calc*) c.calc;
        sheet.sheet = calc->sheet_i(idx);
        sheet.code = 0;
        return sheet;
    } catch (Exception &e) {
        oogo_ebuf_e(e);
        sheet.code = -1;
        return sheet;
    }
}
コード例 #11
0
ファイル: oogo_c.cpp プロジェクト: adrianuswarmenhoven/oogo
sheet_c oogo_sheet_n(calc_c c, const char* name) {
    sheet_c sheet;
    try {
        Calc *calc = (Calc*) c.calc;
        sheet.sheet = calc->sheet_n(name);
        sheet.code = 0;
        return sheet;
    } catch (Exception &e) {
        oogo_ebuf_e(e);
        sheet.code = -1;
        return sheet;
    }
}
コード例 #12
0
ファイル: oogo_c.cpp プロジェクト: adrianuswarmenhoven/oogo
sheet_c oogo_sheet_new(calc_c c, const char* name, int idx) {
    sheet_c sheet;
    try {
        Calc *calc = (Calc*) c.calc;
        sheet.sheet = calc->newSheet(string(name), idx);
        sheet.code = 0;
        return sheet;
    } catch (Exception &e) {
        oogo_ebuf_e(e);
        sheet.code = -1;
        return sheet;
    }
}
コード例 #13
0
ファイル: main.cpp プロジェクト: whitnejo/ExperimentsCpp
int main()
{
    Adder a;
    Calc c;

    a.addNum(10);
    a.addNum(20);
    a.addNum(30);

    c.addNum(10);
    c.addNum(13);
    c.subNum(2);

    cout << "Total " << a.getTotal() << endl;
    cout << "Total " << c.getTotal() << endl;
    cout << "Hey Beautiful, love ya!" << endl;
    return 0;
}
コード例 #14
0
ファイル: a.cpp プロジェクト: filaPro/my
void *thread(void *parasha){
	Manager *mgr = (Manager*)parasha;
	long int t = get_time();
	do{
		Calc *c = mgr->dai_eshe();
		if(c != NULL){
			c->func(c);
			c->m->i_am_done(c);
		}else
			break;
	}while(1);

	pthread_mutex_lock(&mgr->mx);
	cerr << "thread usage: " << (get_time() - t) << endl;
	pthread_mutex_unlock(&mgr->mx);

	return NULL;
}
コード例 #15
0
ファイル: MultiplyKaratsuba.cpp プロジェクト: dubenju/javay
/*
 * メイン処理
 */
int main()
{
    try
    {
        // 計算クラスインスタンス化
        Calc objCalc;

        // 乗算 ( Karatsuba 法 )
        objCalc.calcKaratsuba();
    }
    catch (...) {
        cout << "例外発生!" << endl;
        return -1;
    }

    // 正常終了
    return 0;
}
コード例 #16
0
int main()
{
	//Calc c;
	//std::cout << "3 + 4 = " << c.add(3, 4) << std::endl;
	//std::cout << "7 * 8 = " << c.multiply(7, 8) << std::endl;
	//std::cout << "5.41 + 7.65 = " << c.add(5.41, 7.65) << std::endl;
	//std::cout << "3.14 * 4.5 = " << c.multiply(3.14, 4.5) << std::endl;

	Calc<int> intCalc;
	std::cout << "3 + 4 = " << intCalc.add(3, 4) << std::endl;
	std::cout << "7 * 8 = " << intCalc.multiply(7, 8) << std::endl;

	Calc<double> doubleCalc;
	std::cout << "5.41 + 7.65 = " << doubleCalc.add(5.41, 7.65) << std::endl;
	std::cout << "3.14 * 4.5 = " << doubleCalc.multiply(3.14, 4.5) << std::endl;
}
コード例 #17
0
ファイル: camera.cpp プロジェクト: gbraz/TrabCG
Camera::Camera(Vertice posicao, Vertice lookAt)
{
    vector<float> vUp;
    Vertice viewUp(lookAt.getX(), lookAt.getY() + 1, lookAt.getZ());
    Calc m;

    this->posicao = posicao.getPos();
    this->lookAt = lookAt;

    vUp = m.verticesParaVetor(viewUp, posicao);

    this->k = m.verticesParaVetor(posicao, lookAt);
    m.transVetUnitario(this->k);

    this->i = m.produtoVetorial(vUp, this->k);
    m.transVetUnitario(this->i);

    this->j = m.produtoVetorial(this->k, this->i);

}
コード例 #18
0
ファイル: Tutorial_7.cpp プロジェクト: Sugrue/UOIT-Projects
int main () {

	vector <int> myVect;
	int temp;


	for (int i = 0; i < 4; i++) 
	{
		cout<<endl<<i<<" value: ";
		cin>> temp;
		myVect.insert(myVect.end(),temp);

		//myVect.push_back(temp);
	}

		for (int i = 0; i < 4; i++) 
	{
		cout<<endl<<"Vector item "<<i<<" = "<<myVect[i];
	}


		int index;
		
		cout<<endl<<endl<<"Relace at (0-4): ";
		cin>>index;
		cout<<endl<<"with what: ";
		cin>>temp;

		myVect[index]=temp;
		
			for (int i = 0; i < 4; i++) 
	{
		cout<<endl<<"Vector item "<<i<<" = "<<myVect[i];
	}
		for (int i = 0; i < 4; i++) 
	{
		myVect.pop_back();
	}

		cout<<endl<<"Size of vector: "<<myVect.size()<<endl<<endl;

		system("pause");
		return 0;



	int a,b;
	Calc myCalc;
	cout<<"Please enter the first integer"<<endl;
	cin>>a;
	cout<<"Please enter the second integer"<<endl;
	cin>>b;

	int sum = myCalc.add(a,b);
	int product = myCalc.multiply(a,b);
	int result = myCalc.divide(a,b);

	cout<<"The sum is: "<<sum<<endl<<"The product is: "<<product<<endl<<"The result is: "<<endl<<endl;


	//start of better calc
	cout<<"Start of the Bcalc"<<endl<<endl;

	double c,d;
	BetterCalc <double> myBCalc;

	cout<<"Please enter the first integer"<<endl;
	cin>>c;
	cout<<"Please enter the second integer"<<endl;
	cin>>d;

	double sum2 = myBCalc.add(c,d);
	double product2 = myBCalc.multiply(c,d);
	double result2 = myBCalc.divide(c,d);

	cout<<"The sum is: "<<sum2<<endl<<"The product is: "<<product2<<endl<<"The result is: "<<result2<<endl;

	system("Pause");
	return 0;

}
コード例 #19
0
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }
    
    Size visibleSize = Director::getInstance()->getVisibleSize();
    Vec2 origin = Director::getInstance()->getVisibleOrigin();

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.

    // add a "close" icon to exit the progress. it's an autorelease object
    auto closeItem = MenuItemImage::create(
                                           "CloseNormal.png",
                                           "CloseSelected.png",
                                           CC_CALLBACK_1(HelloWorld::menuCloseCallback, this));
    
	closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 ,
                                origin.y + closeItem->getContentSize().height/2));

    // create menu, it's an autorelease object
    auto menu = Menu::create(closeItem, NULL);
    menu->setPosition(Vec2::ZERO);
    this->addChild(menu, 1);

    /////////////////////////////
    // 3. add your codes below...

    // add a label shows "Hello World"
    // create and initialize a label
    
    auto label = LabelTTF::create("Hello World", "Arial", 24);
    
    // position the label on the center of the screen
    label->setPosition(Vec2(origin.x + visibleSize.width/2,
                            origin.y + visibleSize.height - label->getContentSize().height));

    // add the label as a child to this layer
    this->addChild(label, 1);

    // add "HelloWorld" splash screen"
    auto sprite = Sprite::create("HelloWorld.png");

    // position the sprite on the center of the screen
    sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));

    // add the sprite as a child to this layer
    this->addChild(sprite, 0);

    Calc *calc = new Calc();
    calc->addValue(1000);
    std::stringstream ss;
    ss << calc->getValue();
    
    auto calcLabel = LabelTTF::create();
    calcLabel->setString(ss.str());
    calcLabel->setFontSize(24);
    calcLabel->setFontName("Arial");
    calcLabel->setPosition(100, 100);
    this->addChild(calcLabel);

    return true;
}
コード例 #20
0
ファイル: 20.cpp プロジェクト: chrismp/learning-c-plus-plus
// if you wanted to add 5, sub 3, multiply by 4, you'd need to do this:
int main(){
	Calc calc;	// default constructor, m_value is 0
	calc.add(5).sub(3).mult(4);
	std::cout << calc.getValue() << '\n';
	return 0;
}
コード例 #21
0
ファイル: main.cpp プロジェクト: vportilheiro/Calc
int main() {
    Calc calculator;
    calculator.push(3);
    calculator.push(4.0);
    return 0;
}