Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // assesment 2.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- using namespace std;
- //declare dynamic array of inknowen size
- int storespace[] = {232,241,324,216,221,298,334,212,235,324,264,141};
- int array_size = sizeof(storespace);
- int element_size =sizeof(storespace[0]);
- int MAX = (array_size / element_size);
- void print_total();
- void calculate();
- void calculate()
- {
- int count = 0;
- int biggest = storespace[count];
- for (count = 0; count < MAX; count++)
- {
- if ( biggest < storespace [count] )
- {
- biggest = storespace[count];
- }//end if
- }//end for
- cout << "Biggest is: " << biggest << endl;
- }
- void print_total()
- {
- for (int count = 0; count < MAX; count++)
- {
- //cout << storespace[count] << endl;
- }//end for
- cout << "MAX: " << MAX << endl;
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- calculate();
- print_total();
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement