Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <iomanip>
- #include <string>
- using namespace std;
- void Calculations(int even[], int odd[], int x, int& highest, int& lowest, float& average);
- int main ()
- {
- int num[50], even[50], odd[50];
- int highest, lowest, x=0;
- float average;
- ifstream infile;
- ofstream Odd, Even;
- infile.open("C:\\Users\\Tiffani\\Documents\\FileM.txt");
- if (!infile)
- {
- cout<<"Unable to Open file. Terminating Program"<<endl;
- system ("pause");
- exit (1);
- }
- Odd.open ("C:\\Users\\Tiffani\\Documents\\Oddput.txt");
- Even.open ("C:\\Users\\Tiffani\\Documents\\Evenput.txt");
- while (!infile.eof())
- {
- infile>>num[x];
- for(x=0; x<50; x++)
- {
- if (num[x]%2==0)
- {
- even[x]=num[x];
- Even<<even[x]<<" ";
- Calculations(even[x], odd[x], )
- break;
- }
- else
- {
- odd[x]=num[x];
- Odd<<odd[x]<<" ";
- break;
- }
- }
- }
- infile.close();
- Odd.close();
- Even.close();
- return 0;
- }
- void Calculations(int even[], int odd[], int x, int& highest, int& lowest, float& average)
- {
- average+=num[x];
- if(num[x]>highest)
- highest=num[x];
- else if (num[x]<lowest)
- lowest=num[x];
- }
Add Comment
Please, Sign In to add comment