Enter the complex number expression: (5 + -6i) / (0 + 0i)
(5 + -6i) / (0 + 0i) is undefined.
我要把上面這個描述用進去....
我該怎麼做呢 ... 請幫幫忙 謝謝^^"
===========================================
main() {
int a, b, c, d, e, f;
char op; /*加減乘除*/
printf("Enter the fraction expression: ");
scanf("%d/%d %c %d/%d", &a, &b, &op, &c, &d);
printf("%d/%d %c %d/%d\n", a, b, op, c, d);
if ( op == '*' ) { /*當算乘法的時候*/
e = a * c ;
f = b * d ;
printf("=%d/%d\n", e, f );
}
else if ( op == '+'){ /*當算加法的時候*/
e = ( a * d ) + ( b * c );
f = ( b * d );
printf("=%d/%d\n", e, f );
}
else if ( op == '-'){ /*當算減法的時候*/
e = ( a * d ) - ( b * c );
f = ( b * d );
printf("=%d/%d\n", e, f );
}
else if ( op == '/'){ /*當算除法的時候*/
e = ( a * d );
f = ( b * c );
printf("=%d/%d\n", e, f );
}
system("Pause");
}
Enter the complex number expression: (5 + -6i) / (0 + 0i)(5 + -6i) / (0 + 0i) is undefined.
我要把上面這個描述用進去....
我該怎麼做呢 ... 請幫幫忙 謝謝^^"
===========================================
main() { int a, b, c, d, e, f; char op; /*加減乘除*/ printf("Enter the fraction expression: "); scanf("%d/%d %c %d/%d", &a, &b, &op, &c, &d); printf("%d/%d %c %d/%d\n", a, b, op, c, d); if ( op == '*' ) { /*當算乘法的時候*/ e = a * c ; f = b * d ; printf("=%d/%d\n", e, f ); } else if ( op == '+'){ /*當算加法的時候*/ e = ( a * d ) + ( b * c ); f = ( b * d ); printf("=%d/%d\n", e, f ); } else if ( op == '-'){ /*當算減法的時候*/ e = ( a * d ) - ( b * c ); f = ( b * d ); printf("=%d/%d\n", e, f ); } else if ( op == '/'){ /*當算除法的時候*/ e = ( a * d ); f = ( b * c ); printf("=%d/%d\n", e, f ); } system("Pause");}