hello this is my first C++ program
my problem is that i cant find out to things
frist is that when i rune it and sett the mathe type it is ignored laiter and hit shows alle offe the posbole mathe types ( that i have enterd +,-,/ and * )
secone prolem is that if i try to multiply or divid whitt 0 my system crashes,
i see that it is a math problem for the pc or somthing butt i have no idd how to fix it.
i was thing som sorrt of program that maksi it so IF num1 or num2 and it is divid or multyply it will render awnser 0 and dont crash it ....
(sorry about my bade writing i am dislectic)
hoppe any one can help
#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
int addition(int x, int y);
int substract(int x, int y);
int multiply(int x, int y);
int divid(int x, int y);
void main(){
int num1;
int num2;
string a;
cout << "what type of math do you want to do?";
cout << endl;
cout << "addition(+), substract(-), multiply(*) or divid(/)" <<endl;
getline(cin, a);
cin.clear();
cout << "you want to " << a <<endl;
cout << "the first number: ";
cin >> num1;
cout << " the secon number: ";
cin >> num2;
bool(a == "add" || "+");
"{";true;
; cout << "the awnser is";
cout <<addition(num1, num2);
cout << endl;
false; {
cout << "";
};
"}";
bool(a == "substract" || "-");
if (true) "{"
; cout << "the awnser is";
cout << substract(num1,num2);
cout << endl;
"}";
if (false) "{"
; cout << "";
"}";
bool(a == "multply" || "*" );
"{" ;true ;{
; cout << "the awnser is";
cout << multiply(num1, num2);
cout << endl; };
false; {
cout << "";
};
"}";
bool(a == "divid" || "/");
"{";true;
; cout << "the awnser is";
cout << divid(num1, num2);
cout << endl;
false; {
cout << "";
};
"}";
_getch();
}
int addition (int x, int y) {
int numawnser;
numawnser = x + y;
return numawnser;
}
int substract (int x, int y) {
int numawnser;
numawnser = x - y;
return numawnser;
}
int multiply (int x, int y) {
int numawnser;
numawnser = x * y;
return numawnser;
}
int divid (int x, int y) {
int numawnser;
numawnser = x / y;
return numawnser;
}