コード例 #1
0
 int CCVirtualCurrencyPack::take(int amount, bool notify, CCError **error) {
     const char *currencyId = getCurrencyItemId()->getCString();
     CCVirtualCurrency *currency = dynamic_cast<CCVirtualCurrency *>(CCStoreInfo::sharedStoreInfo()->getItemByItemId(currencyId, error));
     
     if (currency == NULL) {
         CCSoomlaUtils::logError(TAG, __String::createWithFormat("VirtualCurrency with itemId: %s doesn't exist! Can't take this pack.", currencyId)->getCString());
         return 0;
     }
     
     return CCVirtualCurrencyStorage::getInstance()->remove(currency, getCurrencyAmount()->getValue() * amount, notify, error);
 }
コード例 #2
0
ファイル: pos370-wk4-dcg.c プロジェクト: dcgibbons/learning
/* main program entry point */
int main() 
{
    double currencyAmount;

    displayGreeting();

    currencyAmount = getCurrencyAmount(CURRENCY_NAME);
    if (currencyAmount > 0.0) 
    {
        convertCurrency(CURRENCY_NAME, CURRENCY_EXCHANGE_RATE, currencyAmount);
    }

    return EXIT_SUCCESS;
}