Advertisement
Guest User

ass2

a guest
Mar 5th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. // assesment 2.cpp : Defines the entry point for the console application.
  2. //
  3. #include "stdafx.h"
  4. #include <iostream>
  5. #include <string>
  6. using namespace std;
  7. //declare dynamic array of inknowen size
  8. int storespace[] = {232,241,324,216,221,298,334,212,235,324,264,141};
  9. int array_size = sizeof(storespace);
  10. int element_size =sizeof(storespace[0]);
  11. int MAX = (array_size / element_size);
  12. void print_total();
  13. void calculate();
  14. void calculate()
  15. {
  16. int count = 0;
  17. int biggest = storespace[count];
  18. for (count = 0; count < MAX; count++)
  19. {
  20. if ( biggest < storespace [count] )
  21. {
  22. biggest = storespace[count];
  23. }//end if
  24. }//end for
  25. cout << "Biggest is: " << biggest << endl;
  26. }
  27. void print_total()
  28. {
  29. for (int count = 0; count < MAX; count++)
  30. {
  31. //cout << storespace[count] << endl;
  32. }//end for
  33. cout << "MAX: " << MAX << endl;
  34. }
  35. int _tmain(int argc, _TCHAR* argv[])
  36. {
  37. calculate();
  38. print_total();
  39. getchar();
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement