#include <cmath>#include <iostream>using namespace std;int main(int argc, _TCHAR* argv[]){ int evendata[100]; int odddata[100]; int a, b, c; int multiplyodd=1; int sumeven=0; b=0; c=0; do { cout << "Please enter a positive integer (negative integer to stop):"<< ' '; cin>> a; if (a>0){ if (a%2 == 0 ) { c++; evendata[c]=a; } else{ b++; odddata[b]=a; } } } while (a>=0); cout << "You have entered" << ' '<< b << ' ' <<"odd numbers: " ; for(int i=1;i<=b;i++){ multiplyodd*=odddata[i]; cout<<<" "; } cout << endl<< "And" << ' ' << c << ' ' <<"even numbers: "; for(int i=1;i<=c;i++){ sumeven+=evendata[i]; cout<<<" "; } cout<<<"The sum of even numbers is "<<<<"The multiply of odd numbers is "<<< endl<< "Press any key to exit"; getch(); return 0; }
Comments