我无法在代码块中运行 C++ 代码,怎么办?

问题描述

我创建了一个简单的程序,然后根据视频讲座我需要构建文件,然后我可以运行该文件,但是当我单击运行图标时,会弹出一条消息,要求构建该程序,因此单击是按钮弹出窗口关闭但它没有运行代码,这个问题一次又一次出现,我无法运行程序

我怎样才能克服这个问题? 这是我的代码

    #include <iostream>
    using namespace std;
        int main(){
            int num1,num2,sum,op;

            cout<<"This a simple calculator using c++ language "/n"Enter 
            any two numbers one by one:";
            cin>>num1>>num2;
            cout<<"There are 4 operations in this calculator->"/n"Enter 
            the respective number"/n<<"1. Addition"/n"2. 
            Subtraction"/n"3. Multiplication"/n"4. Division";
            cin>>"Operation">>op;
            if(op = 1){
                sum = num1+num2;
                cout<<"The addition of the given numbers is "<<sum;
            }
            else if(op = 2){
                sum = num1 - num2;
                cout<<"The subtraction of the given numbers is"<<sum;
            }
            else if(op = 3){
                sum = num1 * num2;
                cout<<"The multiplication of the given numbers is"<<sum;
            }
            else if(op = 4){
                sum = num1 / num2;
                cout<<"The division of the given numbers is"<<sum;
            }
            else{
                cout<<"Oop!! an error occurred... try again."
            }
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)