1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#include <iostream>
#include <string>
using namespace std;
//functions
float time_block(float, float); // finds time needed (days) to generate one block
float coins_block (float);
float currency_day(float,float);// finds amount of bitcoins and dollars made per day.
float electricity_cost(float,float);
float total_profit(float,float,float,float);
// calculated variables
float timeperblock;
float costs;
float profit;
float totalprofit;
float coinsperblock;
float total_blocks;
float coinsperday;
float dollarsperday;
float electricitycost;
//input variables
float difficulty;
float market_price;
float hardware_cost;
float power_usage;
float electricity;
float mining_speed;
float time;
int main(){
cout<<"What is the current bitcoin mining difficulty? This can be found at: http://blockchain.info/blocks" <<endl;
cin>> difficulty;
cout<<"What is the current number of total blocks mined by the community? This can be found at:http://blockchain.info/blocks" <<endl;
cin>> total_blocks;
cout<<"What is the current Market Price for Bitcoins? Can be found at:http://blockchain.info/blocks" <<endl;
cin>>market_price;
cout<<"What was the cost of Hardware in your mining rig? " <<endl;
cin>> hardware_cost;
cout<<"What is the Power Usage on your machine? Check PSU wattage." <<endl;
cin>>power_usage;
cout<<"What is your cost of electricity at your current residency?In U.S. typically .11 USD/kWh" <<endl;
cin>> electricity;
cout<<"What is your current mining speed in Mhash/s? Can be found: https://en.bitcoin.it/wiki/Mining_hardware_comparison" <<endl;
cin>> mining_speed;
cout<<"How long do you plan on running your rig in time days?" <<endl;
cin>> time;
time_block(difficulty,mining_speed);
coins_block(total_blocks);
currency_day (timeperblock, coinsperblock);
electricity_cost(electricity, power_usage);
total_profit(dollarsperday,electricitycost,hardware_cost,time);
cout <<totalprofit <<endl;
}
float time_block (float d, float s){
timeperblock= (d * 4294967296) / s;
return timeperblock;
}
float coins_block(float total_blocks){
float multiplyer;
multiplyer= total_blocks/210000;
coinsperblock = 25*multiplyer;
return coinsperblock; // why does this equal 0?
}
float currency_day(float timeperblock, float coinsperblock){
coinsperday = timeperblock*coinsperblock;
dollarsperday = coinsperday*market_price;
return coinsperday, dollarsperday;
}
float electricity_cost(float electricity,float power_usage){
int costperhour;
costperhour = electricity*(power_usage/1000);
electricitycost = costperhour*24*time;
return electricitycost;
}
float total_profit(float dollarsperday,float electricitycost, float hardware_cost,float time){
totalprofit=(dollarsperday*time)-(electricitycost+hardware_cost);
return totalprofit;
}
|