can't figure this out

Just going off the cuff to submit my code. I can't figure out the process to submit it in the forum. Hopefully I can find a solution in obtaining the odd integers in an array. Code (that I should have posted in the forum):
// Add up the odd integers in an array.
#include <iostream>
#include<cmath>
#include<fstream>
#include <cstdlib>
using namespace std;

//const int number = 10;

int populate(int myArray[], int number);
void spit(int myArray[], int number);


int main()
{

int dennis[5] = {};
populate(dennis, 5);
spit(dennis, 5);
system("pause");
return 0;
}


int populate(int myArray[], int number){
int input;
int i;
for (i = 0; i < number; i++)
{
cout << "enter an integer: " << (i + 1) << endl;
cin >> input;
myArray[i] = input;
}
return i;
}
void spit(int myArray[], int number)
;
int total
for (int i = 0; i < number; i++){
if (i % 2 == 0)//working this section
cout << i << " is even.";
else
cout << i << " is odd. Add " << i << " to total.";

total += myArray[i];
cout << "The value of number " << (i + 1) << " is: " << myArray[i] << endl;
}
}
Last edited on
> I can't figure out the process to submit it in the forum.
I'm sick of it. Will start using gist (a better alternative is welcomed).
https://gist.github.com/anonymous/fe29f5330afa900b54d326c72332efd0
Topic archived. No new replies allowed.