Help please

Can I have some help on this bit of code please?
[The code] (https://www.codecademy.com/workspaces/6325eac627777839820e1137)

It appears your link is broken.

ok i will try and fix it

#include <iostream> #include <vector> int main () { int options; std::vector<int> total_even(); std::vector<int> total_odd(); std::vector<int> even(); std::vector<int> odd(); std::vector<int> input(); std::cout << "Welcome to the Odd and Even Number Calculator!\n"; std::cout << "What Would You Like To Do Today?\n"; std::cout << "\nOptions:\n"; std::cout << "\n1. Find out my Even and Odd Numbers.\n"; std::cout << "2. Multiply my Even and Odd Numbers.\n"; std::cout << "3. Add my Even and Odd Numbers.\n"; std::cout << "4. Add my Even Numbers but Multiply my Odd Numbers.\n"; std::cout << "5. Multiply my Even Numbers but Add my Odd Numbers.\n"; std::cin >> options; for (int i = 0; options != 1 || options != 2 || options != 3 || options != 4 || options != 5; i++) { for (int j = 1; i > j; j++) { if (options != 1 || options != 2 || options != 3 || options != 4 || options != 5) { std::cout << "\n1. Find out my Even and Odd Numbers.\n"; std::cout << "2. Multiply my Even and Odd Numbers.\n"; std::cout << "3. Add my Even and Odd Numbers.\n"; std::cout << "4. Add my Even Numbers but Multiply my Odd Numbers.\n"; std::cout << "5. Multiply my Even Numbers but Add my Odd Numbers.\n"; std::cin >> options; } else { std::cout << "\nNow insert your numbers here:\n"; std::cout << "\nNOTE: ONLY Use Whole Numbers.\n"; std::cin >> input; } if (options = 1) { for (int k = 0; k < input.size(); k++) { if (input[i] % 2 == 0) { even = input[i]; } else { odd = input[i]; } std::cout << "\nYour Even Numbers are: " << even << "\n"; std::cout << "\nYour Odd Numbers are: " << odd << "\n"; } } else if (options = 2) { for (int l = 0; l < input.size(); l++) { if (input[i] % 2 == 0) { even = input[i]; total_even = even * input[even]; } else { odd = input[i]; total_odd = odd * input[odd]; } std::cout << "The Product of your Even Numbers are: " << total_even << "\n"; std::cout << "The Product of your Odd Numbers are: " << total_odd << "\n"; } else if (options = 3) { for (int m = 0; m < input.size(); m++) { if (input[i] % 2 == 0) { even = input[i]; total_even = even + input[even]; } else { odd = input[i]; total_odd = odd + input[odd]; } std::cout << "The Sum of your Even Numbers are: " << total_even << "\n"; std::cout << "The Sum of your Odd Numbers are: " << total_odd << "\n"; } else if (options = 4) { for (int m = 0; m < input.size(); m++) { if (input[i] % 2 == 0) { even = input[i]; total_even = total_even + input[even]; } else { odd = input[i]; total_odd = total_odd * input[odd]; } std::cout << "The Sum of your Even Numbers are: " << total_even << "\n"; std::cout << "The Product of your Odd Numbers are: " << total_odd << "\n"; } else if (options = 5) { for (int n = 0; n < input.size(); n++) { if (input[i] % 2 == 0) { even = input[i]; total_even = total_even * input[even]; } else { odd = input[i]; total_odd = total_odd + input[odd]; } std::cout << "The Product of your Even Numbers are: " << total_even << "\n"; std::cout << "The Sum of your Odd Numbers are: " << total_odd << "\n"; } } } } }

I will preface this all with the information that I haven’t coded in C++ in a long time. Others may be able to provide some additional details. Here are some observations:

Several instances of your conditional checks don’t have the proper syntax. Conditional should use double equal to compare equality.

if (options == 1)

I think there are several issues with your usage of vectors, from declaration to attempting input and output. Perhaps this tutorial can help?
for example, you are attempting to stream input into the inputs integer. I think this has to be separated out. Using a helper variable may be the answer.

else {
        std::cout << "\nNow insert your numbers here:\n";
        std::cout << "\nNOTE: ONLY Use Whole Numbers.\n";
        int num;
        std::cin >> num;
        input.push_back(num);
      }

Likewise to stream the output from a vector, you need to approach it differently I believe. You need to iterate over the vector like this:

std::cout << "\nYour Even Numbers are: ";
for (const int& i : even) {
    cout << i << "  ";
  }
std::cout << "\n";

Again, I am not an expert in c++, but hopefully this will get you moving on the right track.

1 Like

this is my code so far:

#include <iostream> #include <vector> int main () { int options; std::vector <std::string> input(); std::vector <std::string> total_even(); std::vector <std::string> total_odd(); std::vector <std::string> even(); std::vector <std::string> odd(); std::cout << "Welcome to the Odd and Even Number Calculator!\n"; std::cout << "What Would You Like To Do Today?\n"; std::cout << "\nOptions:\n"; for (int i = 0; options != 1 || options != 2 || options != 3 || options != 4 || options != 5; i++) { if (options != 1 || options != 2 || options != 3 || options != 4 || options != 5) { std::cout << "\n1. Find out my Even and Odd Numbers.\n"; std::cout << "2. Multiply my Even and Odd Numbers.\n"; std::cout << "3. Add my Even and Odd Numbers.\n"; std::cout << "4. Add my Even Numbers but Multiply my Odd Numbers.\n"; std::cout << "5. Multiply my Even Numbers but Add my Odd Numbers.\n"; std::cin >> options; } else { std::cout << "\nNow insert your numbers here:\n"; std::cout << "\nNOTE: ONLY Use Whole Numbers.\n"; int num; std::cin >> num; input.push_back(num); } } if (options == 1) { for (int inputi: input) { if (input[inputi] % 2 == 0) { even = input[even]; } else { odd = input[odd]; } std::cout << "\nYour Even Numbers are: " << even << "\n"; std::cout << "\nYour Odd Numbers are: " << odd << "\n"; } } else if (options == 2) { for (int inputi: input) { if (input[inputi] % 2 == 0) { even = input[even]; total_even = even * input[even]; } else { odd = input[odd]; total_odd = odd * input[odd]; } } std::cout << "The Product of your Even Numbers are: " << total_even << "\n"; std::cout << "The Product of your Odd Numbers are: " << total_odd << "\n"; } else if (options == 3) { for (int inputi: input) { if (input[inputi] % 2 == 0) { even = input[even]; total_even = even + input[even]; } else { odd = input[odd]; total_odd = odd + input[odd]; } } std::cout << "The Sum of your Even Numbers are: " << total_even << "\n"; std::cout << "The Sum of your Odd Numbers are: " << total_odd << "\n"; } else if (options == 4) { for (int inputi: input) { if (input[inputi] % 2 == 0) { even = input[even]; total_even = total_even + input[even]; } else { odd = input[odd]; total_odd = total_odd * input[odd]; } } std::cout << "The Sum of your Even Numbers are: " << total_even << "\n"; std::cout << "The Product of your Odd Numbers are: " << total_odd << "\n"; } else if (options == 5) { for (int inputi: input) { if (input[inputi] % 2 == 0) { even = input[even]; total_even = total_even * input[even]; } else { odd = input[odd]; total_odd = total_odd + input[odd]; } } std::cout << "The Product of your Even Numbers are: " << total_even << "\n"; std::cout << "The Sum of your Odd Numbers are: " << total_odd << "\n"; } }

You need .push_back in a lot more places,
and note that you can’t just do std::cout << odd; since odd is a vector

Here’s an possible way to do the option 1 stuff:

  if (options == 1) {
    for (int inputi: input) {
      if (input[inputi] % 2 == 0) {
        even.push_back(input[inputi]);         
      }
      else {
        odd.push_back(input[inputi]);           
      }
    }
    std::cout << "\nYour Even Numbers are: ";
    int length = even.size();
    for (int m = 0; m < length; m++) {
      std::cout << even[m] << ", ";
    }
    std::cout << "\n";
    std::cout << "\nYour Odd Numbers are: "; 
    length = odd.size();
    for (int m = 0; m < length; m++) {
      std::cout << odd[m] << ", ";
    }
    std::cout << "\n";
  }

Although I think that for-in loops are better for vectors in this case.

Also, why did you change <int> to <std::string> for the vectors?

If i change the std::string back to int again, will it effect anything?

So, I have written this so far:

#include <iostream> #include <vector> int main() { int options; std::vector <std::string> input(); std::vector <std::string> total_even(); std::vector <std::string> total_odd(); std::vector <std::string> even(); std::vector <std::string> odd(); std::cout << "Welcome to the Odd and Even Number Calculator!\n"; std::cout << "What Would You Like To Do Today?\n"; std::cout << "\nOptions:\n"; if (options != 1 || options != 2 || options != 3 || options != 4 || options != 5) { std::cout << "\n1. Find out my Even and Odd Numbers.\n"; std::cout << "2. Multiply my Even and Odd Numbers.\n"; std::cout << "3. Add my Even and Odd Numbers.\n"; std::cout << "4. Add my Even Numbers but Multiply my Odd Numbers.\n"; std::cout << "5. Multiply my Even Numbers but Add my Odd Numbers.\n"; std::cin >> options; } else { std::cout << "\nNow insert your numbers here:\n"; std::cout << "\nNOTE: ONLY Use Whole Numbers.\n"; int num; std::cin >> num; input.push_back(num) } if (options == 1) { for (int inputi = input) { if (input[inputi] % 2 == 0) { even.push_back(input[inputi]); } else { odd.push_back(input[inputi]); } } std::cout << "\nYour Even Numbers are: "; int length = even.size(); for (int m = 0; m < length; m++) { std::cout << even[m] << ", "; } std::cout << "\n"; std::cout << "\nYour Odd Numbers are: "; length = odd.size(); for (int m = 0; m < length; m++) { std::cout << odd[m] << ", "; } std::cout << "\n"; } else if (options == 2) { for (int inputi = input;) { if (input[inputi] % 2 == 0) { even.push_back(input[inputi]); total_even.push_back(even * input[inputi]) } else { odd.push_back(input[inputi]); total_odd.push_back(odd * input[inputi]); } } std::cout << "\nThe Product of your Even Numbers are: "; int length = total_even.size(); for (int m = 0; m < length; m++) { std::cout << total_even[m] << ", "; } std::cout << "\n"; std::cout << "\nThe Product of your Odd Numbers are: "; length = total_odd.size(); for (int m = 0; m < length; m++) { std::cout << odd[m] << ", "; } std::cout << "\n"; } else if (options == 3) { for (int inputi = input;) { if (input[inputi] % 2 == 0) { even.push_back(input[inputi]); total_even.push_back(even + input[inputi]) } else { odd.push_back(input[inputi]); total_odd.push_back(odd + input[inputi]) } } std::cout << "\nThe Sum of your Even Numbers are: "; int length = total_even.size(); for (int m = 0; m < length; m++) { std::cout << total_even[m] << ", "; } std::cout << "\n"; std::cout << "\nThe Sum of your Odd Numbers are: "; length = total_odd.size(); for (int m = 0; m < length; m++) { std::cout << total_odd[m] << ", "; } std::cout << "\n"; } else if (options == 4) { for (int inputi = input;) { if (input[inputi] % 2 == 0) { even.push_back(input[inputi]); total_even.push_back(even + input[inputi]); } else { odd.push_back(input[inputi]); total_odd.push_back(odd * input[inputi]); } } std::cout << "\nThe Sum of your Even Numbers are: "; int length = total_even.size(); for (int m = 0; m < length; m++) { std::cout << total_even[m] << ", "; } std::cout << "\n"; std::cout << "\nThe Product of your Odd Numbers are: "; length = total_odd.size(); for (int m = 0; m < length; m++) { std::cout << total_odd[m] << ", "; } std::cout << "\n"; } else if (options == 5) { for (int inputi = input;) { if (input[inputi] % 2 == 0) { even.push_back(input[inputi]); total_even.push_back(even * input[inputi]); } else { odd.push_back(input[inputi]); total_odd.push_back(odd + input[inputi]); } } std::cout << "\nThe Product of your Even Numbers are: "; int length = total_even.size(); for (int m = 0; m < length; m++) { std::cout << total_even[m] << ", "; } std::cout << "\n"; std::cout << "\nThe Sum of your Odd Numbers are: "; length = total_odd.size(); for (int m = 0; m < length; m++) { std::cout << total_odd[m] << ", "; } std::cout << "\n"; } }

However, I am having issues with push_back not working.
Why?

You are trying to push strings into a vector of ints, so .push_back throws an error.

Also,
for (int inputi = input;) {
should be
for (int inputi : input) {
which is the syntax for a for-in loop.

You also have
total_even.push_back(even * input[inputi])
which won’t work because even is a vector, not a number (int) so it can’t be “multiplied” by an int.

#include <iostream> #include <vector> int main() { int options; std::vector <int> input(); std::vector <int> total_even(); std::vector <int> total_odd(); std::vector <int> even(); std::vector <int> odd(); std::cout << "Welcome to the Odd and Even Number Calculator!\n"; std::cout << "What Would You Like To Do Today?\n"; std::cout << "\nOptions:\n"; if (options != 1 || options != 2 || options != 3 || options != 4 || options != 5) { std::cout << "\n1. Find out my Even and Odd Numbers.\n"; std::cout << "2. Multiply my Even and Odd Numbers.\n"; std::cout << "3. Add my Even and Odd Numbers.\n"; std::cout << "4. Add my Even Numbers but Multiply my Odd Numbers.\n"; std::cout << "5. Multiply my Even Numbers but Add my Odd Numbers.\n"; std::cin >> options; } else { std::cout << "\nNow insert your numbers here:\n"; std::cout << "\nNOTE: ONLY Use Whole Numbers.\n"; int num; std::cin >> num; input.push_back(num); } if (options == 1) { for (int i = 0; i < input.size(); i++) { if (input[i] % 2 == 0) { even.push_back(input[i]); } else { odd.push_back(input[i]); } } std::cout << "\nYour Even Numbers are: "; std::string length = even.size(); for (int m = 0; m < length; m++) { std::cout << even[m] << ", "; } std::cout << "\n"; std::cout << "\nYour Odd Numbers are: "; length = odd.size(); for (int m = 0; m < length; m++) { std::cout << odd[m] << ", "; } std::cout << "\n"; } else if (options == 2) { for (int i = 0; i < input.size(); i++) { if (input[i] % 2 == 0) { even.push_back(input[i]); total_even.push_back(even[i] * input) } else { odd.push_back(input[i]); total_odd.push_back(odd[i] * input); } } std::cout << "\nThe Product of your Even Numbers are: "; int length = total_even.size(); for (int m = 0; m < length; m++) { std::cout << total_even[m] << ", "; } std::cout << "\n"; std::cout << "\nThe Product of your Odd Numbers are: "; length = total_odd.size(); for (int m = 0; m < length; m++) { std::cout << total_odd[m] << ", "; } std::cout << "\n"; } else if (options == 3) { for (int i = 0; i < input.size(); i++) { if (input[i] % 2 == 0) { even.push_back(input[i]); total_even.push_back(even[i] + input) } else { odd.push_back(input[i]); total_odd.push_back(odd[i] + input) } } std::cout << "\nThe Sum of your Even Numbers are: "; int length = total_even.size(); for (int m = 0; m < length; m++) { std::cout << total_even[m] << ", "; } std::cout << "\n"; std::cout << "\nThe Sum of your Odd Numbers are: "; length = total_odd.size(); for (int m = 0; m < length; m++) { std::cout << total_odd[m] << ", "; } std::cout << "\n"; } else if (options == 4) { for (int i = 0; i < input.size(); i++) { if (input[i] % 2 == 0) { even.push_back(input[i]); total_even.push_back(even[i] + input); } else { odd.push_back(input[i]); total_odd.push_back(odd[i] * input); } } std::cout << "\nThe Sum of your Even Numbers are: "; int length = total_even.size(); for (int m = 0; m < length; m++) { std::cout << total_even[m] << ", "; } std::cout << "\n"; std::cout << "\nThe Product of your Odd Numbers are: "; length = total_odd.size(); for (int m = 0; m < length; m++) { std::cout << total_odd[m] << ", "; } std::cout << "\n"; } else if (options == 5) { for (int i = 0; i < input.size(); i++) { if (input[i] % 2 == 0) { even.push_back(input[i]); total_even.push_back(even[i] * input); } else { odd.push_back(input[i]); total_odd.push_back(odd[i] + input); } } std::cout << "\nThe Product of your Even Numbers are: "; int length = total_even.size(); for (int m = 0; m < length; m++) { std::cout << total_even[m] << ", "; } std::cout << "\n"; std::cout << "\nThe Sum of your Odd Numbers are: "; length = total_odd.size(); for (int m = 0; m < length; m++) { std::cout << total_odd[m] << ", "; } std::cout << "\n"; } }

Anything wrong now?

You may need to change
std::vector <int> input();
to
std::vector <int> input;
(maybe)

also, on line 43 of the Codebyte,
you have
std::string length = even.size();
which should be an int, not a string.

And on line 59,
you have
total_even.push_back(even[i] * input)
which is missing the ;
even[i] is an int, and input is a vector
so those can’t be “multiplied”.
Similarly for line 63.

Later, you also try to do other operations with a vector and int,
which won’t work right.

So, i want to know
How do I do it correctly?

#include <iostream> #include <vector> int main() { int options; std::vector <int> input(); std::vector <int> total_even(); std::vector <int> total_odd(); std::vector <int> even(); std::vector <int> odd(); std::cout << "Welcome to the Odd and Even Number Calculator!\n"; std::cout << "What Would You Like To Do Today?\n"; std::cout << "\nOptions:\n"; if (options != 1 || options != 2 || options != 3 || options != 4 || options != 5) { std::cout << "\n1. Find out my Even and Odd Numbers.\n"; std::cout << "2. Multiply my Even and Odd Numbers.\n"; std::cout << "3. Add my Even and Odd Numbers.\n"; std::cout << "4. Add my Even Numbers but Multiply my Odd Numbers.\n"; std::cout << "5. Multiply my Even Numbers but Add my Odd Numbers.\n"; std::cin >> options; } else { std::cout << "\nNow insert your numbers here:\n"; std::cout << "\nNOTE: ONLY Use Whole Numbers.\n"; int num; std::cin >> num; input.push_back(num); } if (options == 1) { for (int i = 0; i < input.size(); i++) { if (input[i] % 2 == 0) { even.push_back(input[i]); } else { odd.push_back(input[i]); } } std::cout << "\nYour Even Numbers are: "; int length = even.size(); for (int m = 0; m < length; m++) { std::cout << even[m] << ", "; } std::cout << "\n"; std::cout << "\nYour Odd Numbers are: "; length = odd.size(); for (int m = 0; m < length; m++) { std::cout << odd[m] << ", "; } std::cout << "\n"; } else if (options == 2) { for (int i = 0; i < input.size(); i++) { if (input[i] % 2 == 0) { even.push_back(input[i]); total_even.push_back(even[i] * input); } else { odd.push_back(input[i]); total_odd.push_back(odd[i] * input); } } std::cout << "\nThe Product of your Even Numbers are: "; int length = total_even.size(); for (int m = 0; m < length; m++) { std::cout << total_even[m] << ", "; } std::cout << "\n"; std::cout << "\nThe Product of your Odd Numbers are: "; length = total_odd.size(); for (int m = 0; m < length; m++) { std::cout << total_odd[m] << ", "; } std::cout << "\n"; } else if (options == 3) { for (int i = 0; i < input.size(); i++) { if (input[i] % 2 == 0) { even.push_back(input[i]); total_even.push_back(even[i] + input) } else { odd.push_back(input[i]); total_odd.push_back(odd[i] + input) } } std::cout << "\nThe Sum of your Even Numbers are: "; int length = total_even.size(); for (int m = 0; m < length; m++) { std::cout << total_even[m] << ", "; } std::cout << "\n"; std::cout << "\nThe Sum of your Odd Numbers are: "; length = total_odd.size(); for (int m = 0; m < length; m++) { std::cout << total_odd[m] << ", "; } std::cout << "\n"; } else if (options == 4) { for (int i = 0; i < input.size(); i++) { if (input[i] % 2 == 0) { even.push_back(input[i]); total_even.push_back(even[i] + input); } else { odd.push_back(input[i]); total_odd.push_back(odd[i] * input); } } std::cout << "\nThe Sum of your Even Numbers are: "; int length = total_even.size(); for (int m = 0; m < length; m++) { std::cout << total_even[m] << ", "; } std::cout << "\n"; std::cout << "\nThe Product of your Odd Numbers are: "; length = total_odd.size(); for (int m = 0; m < length; m++) { std::cout << total_odd[m] << ", "; } std::cout << "\n"; } else if (options == 5) { for (int i = 0; i < input.size(); i++) { if (input[i] % 2 == 0) { even.push_back(input[i]); total_even.push_back(even[i] * input); } else { odd.push_back(input[i]); total_odd.push_back(odd[i] + input); } } std::cout << "\nThe Product of your Even Numbers are: "; int length = total_even.size(); for (int m = 0; m < length; m++) { std::cout << total_even[m] << ", "; } std::cout << "\n"; std::cout << "\nThe Sum of your Odd Numbers are: "; length = total_odd.size(); for (int m = 0; m < length; m++) { std::cout << total_odd[m] << ", "; } std::cout << "\n"; } }

I think that total_even and total_odd should not be vectors; they should be integers,
because the sum of a set of numbers is just one number, the product of a set of numbers is just one number.

option: functions for sum and product

Here’s how you might calculate the sum of a vector of integers:

int sum(std::vector<int> list) {
  int sum_so_far = 0;
  for (int x : list) {
    sum_so_far += x;
  }
  return sum_so_far;
}

int product(std::vector<int> list) {
  int product_so_far = 0;
  for (int x : list) {
    product_so_far *= x;
  }
  return product_so_far;
}
#include <iostream>
#include <vector>

int main() {
  int options = 1;
  std::vector<int> input;
  int total_even = 0;
  int total_odd = 0;
  std::vector<int> even;
  std::vector<int> odd;

  std::cout << "Welcome to the Odd and Even Number Calculator!\n";
  std::cout << "What Would You Like To Do Today?\n";
  std::cout << "\nOptions:\n";
  
    if (options != 1 || options != 2 || options != 3 || options != 4 || options != 5) {
      std::cout << "\n1. Find out my Even and Odd Numbers.\n";
      std::cout << "2. Multiply my Even and Odd Numbers.\n";
      std::cout << "3. Add my Even and Odd Numbers.\n";
      std::cout << "4. Add my Even Numbers but Multiply my Odd Numbers.\n";
      std::cout << "5. Multiply my Even Numbers but Add my Odd Numbers.\n";
      std::cin >> options;
    }
    
    else {
      std::cout << "\nNow insert your numbers here:\n";
      std::cout << "\nNOTE: ONLY Use Whole Numbers.\n";
      int num;
      std::cin >> num;
      input.push_back(num);
    }
  
  if (options == 1) {
    for (int i = 0; i < input.size(); i++) {
      if (input[i] % 2 == 0) {
        even.push_back(input[i]);         
      }
      else {
        odd.push_back(input[i]);           
      }
    }
    std::cout << "\nYour Even Numbers are: ";
    int length = even.size();
    for (int m = 0; m < length; m++) {
      std::cout << even[m] << ", ";
    }
    std::cout << "\n";
    std::cout << "\nYour Odd Numbers are: "; 
    length = odd.size();
    for (int m = 0; m < length; m++) {
      std::cout << odd[m] << ", ";
    }
    std::cout << "\n";
  }
  else if (options == 2) {
    total_even = 1;
    total_odd = 1;
    for (int i = 0; i < input.size(); i++) {
      if (input[i] % 2 == 0) {
        even.push_back(input[i]);
        total_even = total_even * input[i]; // product        
      }
      else {
        odd.push_back(input[i]);
        total_odd = total_odd * input[i]; // product          
      }
    }
    std::cout << "\nThe Product of your Even Numbers is: ";
    std::cout << total_even << ", ";
    std::cout << "\n";
    std::cout << "\nThe Product of your Odd Numbers is: "; 
    std::cout << total_odd << ", ";
    std::cout << "\n";
  }
  else if (options == 3) {
    total_even = 0;
    total_odd = 0;
    for (int i = 0; i < input.size(); i++) {
      if (input[i] % 2 == 0) {
        even.push_back(input[i]);
        total_even = total_even + input[i]; // sum         
      }
      else {
        odd.push_back(input[i]);
        total_odd = total_odd + input[i]; // sum      
      }
    }
    std::cout << "\nThe Sum of your Even Numbers is: ";
    std::cout << total_even << ", ";
    std::cout << "\n";
    std::cout << "\nThe Sum of your Odd Numbers is: "; 
    std::cout << total_odd << ", ";
    std::cout << "\n";
  }
  else if (options == 4) {
    total_even = 0;
    total_odd = 1;
    for (int i = 0; i < input.size(); i++) {
      if (input[i] % 2 == 0) {
        even.push_back(input[i]);
        total_even = total_even + input[i];  // sum       
      }
      else {
        odd.push_back(input[i]);
        total_odd = total_odd * input[i]; // product          
      }
    }
    std::cout << "\nThe Sum of your Even Numbers is: ";
    std::cout << total_even << ", ";
    std::cout << "\n";
    std::cout << "\nThe Product of your Odd Numbers is: "; 
    std::cout << total_odd << ", ";
    std::cout << "\n";
  }
  else if (options == 5) {
    total_even = 1;
    total_odd = 0;
    for (int i = 0; i < input.size(); i++) {
      if (input[i] % 2 == 0) {
        even.push_back(input[i]);
        total_even = total_even * input[i]; // product        
      }
      else {
        odd.push_back(input[i]);
        total_odd = total_odd + input[i]; // sum          
      }
    }
    std::cout << "\nThe Product of your Even Numbers is: ";
    std::cout << total_even << ", ";
    std::cout << "\n";
    std::cout << "\nThe Sum of your Odd Numbers is: "; 
    std::cout << total_odd << ", ";
    std::cout << "\n";
  }
}