How would I make this program that it tells me the number of odds or evens. I only have 1 number at the time, so I need it to either say 1 odd or 1 even.
#include <iostream>
#include <fstream>
using namespace std;
void printInfo();
int nonNegative(int a, int k);
int nexta(int a);
void initialize(int& oddCount , int& evenCount);
void getx(int& a);
int main()
{
int count;
int num;
int zeros;
int odds;
int evens;
int a, k;
k = 0;
char choice = 'Y';
ofstream outFile;
//----------------------------------------
// Call function tagReader with tags1.txt
outFile.open("Langlands.txt");
outFile.close();
printInfo();
nonNegative(a, k);
initialize(odds, evens);
nexta(a);
cout << "=================================\n" << endl;
system("pause");
return 0;
}
//==================================================================//
void printInfo()
{
cout << "=================================\n" << endl;
cout << "Programmer Name: Peter Langlands\n"
<< "Program 3 Description:\n"
<< "CS 150 Spring 2011 Lab CRN:\n"
<< "Date:" << endl;
cout << "=================================\n" << endl;
}
//==================================================================//
int nonNegative(int a, int k)
{
k = 0;
int nexta;
int even = 0;
int odd = 0;
ofstream outFile;
while(!a)
{
k = 0;
k++;
a = nexta;
}
cout << "Enter an nonnegative number: ";
cin >> a;
if ( even % 2== 0 )
{
even++;
}
else
{
odd++;
}
cout << "a" << k << " = " << a;
outFile << "a" << k << " = " << a;
cout << "\nThe integer k such tha a_k = 1 is:" << endl;
cout << "The sum of the series equals:" << endl;
cout << "The largest number of the sequence is:" << endl;
cout << "The largest number in the sequence is in position:" << endl;
cout << "There are " << odd << " odd values in the sequence." << endl;
cout << "There are even " << even << " even values in the sequence." << endl;
}
//==================================================================//
int nexta(int a)
{
}
//==================================================================//
void initialize(int& oddCount , int& evenCount)
{
oddCount = 0;
evenCount = 0;
}
//==================================================================//
void getx(int& a)
{
cin >> a;
}