#include<bits/stdc++.h>

using namespace std;

int main()

{

int a,b;
char c;
cin>>a>>b>>c;
switch(c)
{
	case '+':cout<<a+b;break;
	case '-':cout<<a-b;break;
	case '*':cout<<a*b;break;
	case '/':if(b!=0) cout<<a/b;else cout<<"Divided by zero!";break;
	default:cout<<"Invalid operator!";
}
return 0;

}

2 条评论

  • @ 2025-8-8 10:24:47
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int a,b;
        char f;
        cin>>a>>b>>f;
        if(f=='+'){
            cout<<a+b;
        }
        else if(f=='-'){
            cout<<a-b;
        }
        else if(f=='*'){
            cout<<a*b;
        }
        else if(f=='/'){
            if(b==0){
                cout<<"Divided by zero!";
            }
            else{
                cout<<a/b;
            }
        }
        else{
            cout<<"Invalid operator!";
        }
        return 0;
    }
    
    
    
    • @ 2025-5-25 14:37:19

      #include #include #include using namespace std;

      int main() { double x1, y1, x2, y2, x3, y3; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

      double area = 0.5 * abs((x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2)));
      
      cout << fixed << setprecision(2) << area << endl;
      return 0;
      

      }

      • 1

      信息

      ID
      61
      时间
      ms
      内存
      MiB
      难度
      4
      标签
      递交数
      133
      已通过
      64
      上传者