I started reading the using C++ tutorials a couple days ago, and have had no experience programming in any language before that. I'm attempting to write a very simple program that lets me choose between multiplication and division, then do that function to two numbers. what I have so far is this:
Code:
#include <iostream>

using namespace std;

int mult ( int x, int y );

int function; //the variable "function" is what chooses between multiply and divide
int main()
{
     cout<<"enter 1 for multiplication, 2 for division.";
     cin>>function; //my trouble is that it uses multiply regardless of what number you enter for "function"
if (function = 1){ 
  int x;
  int y;
  
  cout<<"Please input two numbers to be multiplied: ";
  cin>> x >> y;
  cin.ignore();
  cout<<"The product of your two numbers is "<< (x * y) <<"\n";
  cin.get();
}
else if (function = 2) {
     int a;
     int b;
     cout<<"Please input two numbers to be divided: ";
     cin>> a >> b;
     cin.ignore();
     cout<<"the two numbers divided is " << (a / b) <<"\n";
     cin.get(); 
     }
     }
can you guys help me out? it works for multiplying, but I can't get it to go to the second string for "if (function = 2). Any other code-writing tips would be helpful as well. thank you very much!