Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int inputarray[50] = {1,2,3,4,5}; // etc etc etc
- int outOdds[50] = {-1}; // init them all to -1
- int outEvents[50] = {-1};
- void doSomething( int* arrayOdds, int* arrayEvens )
- {
- // no idea what your totalling stuff is supposed to do but heres how you access the arrays:
- for (int i=0; i<50; i++)
- {
- cout << arrayOdds[i];
- cout << arrayEvens[i];
- }
- }
- void main()
- {
- int oddsIter = 0;
- int evensIter = 0;
- for (int i=0; i<50; i++)
- {
- if (inputarray[i] % 1 == 0)
- {
- outOdds[oddsIter] = inputarray[i];
- oddsIter++;
- }
- else
- {
- outEvens[evensIter] = inputarray[i];
- evensIter++;
- }
- }
- doSomething(outOdds, outEvens);
- }
Add Comment
Please, Sign In to add comment