fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct AccountData {
  5. int consult;
  6. int minutes;
  7. double rate;
  8. double result;
  9. double payment;
  10. };
  11. AccountData makeAccount(int consult, int minutes, double rate, double result, double payment)
  12. {
  13. return AccountData({consult, minutes, rate, result, payment});
  14. }
  15. void high_procedure(AccountData *thisAccount)
  16. {
  17. cout << "do something with the account, like printing out \"payment \""
  18. << thisAccount->payment
  19. << "\n";
  20. }
  21. void low_procedure(AccountData *thisAccount)
  22. {
  23. thisAccount->payment+=1.0;
  24. cout << "do something with the account, like adding 1 to \"payment \""
  25. << "\n";
  26. }
  27. int main() {
  28. AccountData account1 = makeAccount(1,2,3,4,5);
  29. high_procedure(&account1);
  30. low_procedure(&account1);
  31. high_procedure(&account1);
  32.  
  33. AccountData account2 = makeAccount(10,20,30,40,50);
  34. high_procedure(&account2);
  35. low_procedure(&account2);
  36. high_procedure(&account2);
  37. // your code goes here
  38. return 0;
  39. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
do something with the account, like printing out "payment "5
do something with the account, like adding 1 to "payment "
do something with the account, like printing out "payment "6
do something with the account, like printing out "payment "50
do something with the account, like adding 1 to "payment "
do something with the account, like printing out "payment "51