コード例 #1
0
ファイル: BettingMoney.cpp プロジェクト: maximo1225/tc
int main(){

    struct test_thing{
        test_thing(vector<int> a, vector<int> c, int f): amounts(a), centsPerDollar(c), finalResult(f) {}
        vector<int> amounts;
        vector<int> centsPerDollar;
        int finalResult;
    };

    // we'll setup our test values here
    vector<test_thing> test_vals =
        {{{10, 20, 30}, {20, 30, 40}, 1},
        {{200,300,100},{10,10,10},2},
        {{100,100,100,100},{5,5,5,5},0},
        {{5000,5000},{100,2},0},
        {{100},{10},0}
        };

    BettingMoney bet;
    for (int i = 0; i < test_vals.size(); i++) {
        int return_cents = bet.moneyMade(test_vals[i].amounts,
            test_vals[i].centsPerDollar,
            test_vals[i].finalResult);
        cout << "Total return: " << return_cents << endl;
    }
}
コード例 #2
0
int main(int argc, char *argv[])
{
	BettingMoney obj;
	vector<int> v1, v2;
	v1.push_back(10);
	v1.push_back(20);
	v1.push_back(30);

	v2.push_back(20);
	v2.push_back(30);
	v2.push_back(40);

	int finalResult=1;
	cout<<obj.moneyMade(v1,v2,finalResult);

}