fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. using CryptoData = class {
  5. public:
  6. float Bitcoin;
  7. float Ethereum;
  8. float Dash;
  9. };
  10.  
  11. union CryptoQuotes {
  12. CryptoData Data;
  13. float Proxy[sizeof(CryptoData)/sizeof(float)];
  14. };
  15.  
  16. int main() {
  17. CryptoQuotes Crypto;
  18. for(auto i=0; i<3; ++i) Crypto.Proxy[i] = (i+1) * (-1.2);
  19. cout << Crypto.Data.Bitcoin << endl
  20. << Crypto.Data.Ethereum << endl
  21. << Crypto.Data.Dash << endl;
  22. return 0;
  23. }
Success #stdin #stdout 0s 4276KB
stdin
Standard input is empty
stdout
-1.2
-2.4
-3.6