All pastes #272163 Raw Edit

Untitled

public cpp v1 · immutable
·published 2006-12-08 19:58 UTC
rendered paste body
#include <conio.h>#include <iostream>#include <cmath>#define cashcost 120#define chrcost 10#define strcost 1using namespace std;double cash, str, chr, ob_cash, ob_str, ob_chr, curOB;int psize, pbuildings, curbuildings;double getOB(double size, double buildings){    double ob;	ob = 100 * (exp(buildings/(4*size)) - exp(1/4));	ob = (ob < 0) ? 0 : ob;	return ob;}int main(){    cout << "---------------------------------------------------------" << endl;    cout << "--------------  OB Bank Building Calculator by El Bekko -" << endl;    cout << "---------------------------------------------------------" << endl;    cout << "-------------------- Your reserves: ---------------------" << endl;    cout << "Cash: ";    cin >> cash;    cout << "Strontium: ";    cin >> str;    cout << "Chromium: ";    cin >> chr;    cout << "---------------------------------------------------------" << endl;    cout << "--------------------- Planet info: ----------------------" << endl;    cout << "Size: ";    cin >> psize;    cout << "Buildings: ";    cin >> pbuildings;    cout << "---------------------------------------------------------" << endl;    cout << "Looking at a planet with a capacity of " << psize << " and a current amount of buildings of " << pbuildings << endl;	cout << "Starting off with an OB percentage of ~" << (int)getOB(psize, pbuildings) << "%." << endl;	curbuildings = 0;	do	{		curOB = getOB(psize, curbuildings + pbuildings);		ob_cash = cashcost * (1 + (curOB/100));		ob_chr = chrcost * (1 + (curOB/100));		ob_str = strcost * (1 + (curOB/100));		cash -= ob_cash;		chr -= ob_chr;		str -= ob_str;		curbuildings++;	}	while((cash >= ob_cash) && (chr >= ob_chr) && (str >= ob_str));	cout << "You can build " << curbuildings << " banks on this planet with an end OB of " << (int)curOB << "%." << endl;	getch();	return 0;}