Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
707 views
in Technique[技术] by (71.8m points)

codeblocks - I can not run c++ code in code blocks, what to do?

I created a simple program and according to the video lecture I needed to built the file after that I can run the file but when I click the run icon an popup message asking to built the program, so by clicking the yes button that popup window closes but it didn't run the code and this problem occurs again and again and I can not run the program

How can I overcome this problem? this is my code:

    #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."
            }
    }
question from:https://stackoverflow.com/questions/65952768/i-can-not-run-c-code-in-code-blocks-what-to-do

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...