解题思路:
注意事项:
参考代码:
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int m=sc.nextInt();
int a=sc.nextInt();
char op=sc.next().charAt(0);
int n=sc.nextInt();
int b=sc.nextInt();
if(op=='-'){
System.out.print(m-n);
if(Math.abs((a-b))!=0){
System.out.print((((a-b)<0)?"-":"+")+Math.abs((a-b))+"i");
}
}
else {
System.out.print(m+n);
if(Math.abs((a+b))!=0){
System.out.printf((((a+b)<0)?"-":"+")+Math.abs((a+b))+"i");
}
}
}
}
0.0分
2 人评分
C语言程序设计教程(第三版)课后习题6.1 (C语言代码)浏览:664 |
不容易系列 (C语言代码)浏览:664 |
C语言程序设计教程(第三版)课后习题1.5 (C++代码)浏览:755 |
【亲和数】 (C语言代码)浏览:855 |
C语言考试练习题_排列 (C语言代码)浏览:719 |
C语言程序设计教程(第三版)课后习题6.5 (C语言代码)浏览:624 |
简单的a+b (C语言代码)浏览:596 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:664 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:519 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:466 |