usenmsp.cpp 891 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // usenmsp.cpp -- using namespaces
  2. #include <iostream>
  3. #include "namesp.h"
  4. void other(void);
  5. void another(void);
  6. int main(void)
  7. {
  8. using debts::Debt;
  9. using debts::showDebt;
  10. Debt golf = { {"Benny", "Goatsniff"}, 120.0 };
  11. showDebt(golf);
  12. other();
  13. another();
  14. // std::cin.get();
  15. // std::cin.get();
  16. return 0;
  17. }
  18. void other(void)
  19. {
  20. using std::cout;
  21. using std::endl;
  22. using namespace debts;
  23. Person dg = {"Doodles", "Glister"};
  24. showPerson(dg);
  25. cout << endl;
  26. Debt zippy[3];
  27. int i;
  28. for (i = 0; i < 3; i++)
  29. getDebt(zippy[i]);
  30. for (i = 0; i < 3; i++)
  31. showDebt(zippy[i]);
  32. cout << "Total debt: $" << sumDebts(zippy, 3) << endl;
  33. return;
  34. }
  35. void another(void)
  36. {
  37. using pers::Person;;
  38. Person collector = { "Milo", "Rightshift" };
  39. pers::showPerson(collector);
  40. std::cout << std::endl;
  41. }