#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int even = 0, odd = 0, dig, num;
cout << "Please enter a list of numbers (-7777 to terminate)" << endl;
cin >> num;
while (num != -7777) // off the wall check value
{
// dig = num % 10;
// num = num / 10; <--- what are these for?
if(dig % 2 == 0) // if the number is even
even += num; // add it to the previous even sum
else
odd += num; // otherwise add it to the odd sum
cout << "Enter next number: ";
cin >> num;
}
cout << "The sum of the even integers is: " << even << endl;
cout << "The sum of the odd integers is: " << odd << endl;
return 0;
}
I would love to change the world, but they won't give me the source code