我有一个3文件程序,基本上自学c ++.我有一个问题.我做了一个开关来使用数学函数.我需要把它放在一个变量中,但由于某种原因我得到一个零.
还有一个问题,当我选择4(除)时它会崩溃......有原因吗?
主文件:
#include <iostream>
#include "math.h"
#include <string>
using namespace std;
int opersel;
int c;
int a;
int b;
string test;
int main(){
cout << "Welcome to Math-matrix v.34"<< endl;
cout << "Shall we begin?" <<endl;
//ASK USER IF THEY ARE READY TO BEGIN
string answer;
cin >> answer;
if(answer == "yes" || answer == "YES" || answer == "Yes")
{
cout << "excellent lets begin..." << endl;
cout << "please select a operator..." << endl << endl; …Run Code Online (Sandbox Code Playgroud)