pgm110a.cppにおいて、入力された整数が負の場合も考慮してプログラムを修正せよ。
入力例:
Input two numbers : 2 -3
x = -2/3
void Ratio::display(){ if(num*den>0) cout << abs(num) << "/" << abs(den) << "\n"; else cout << -abs(num) << "/" << abs(den) << "\n"; }
入力例:
Input two numbers : 2 -3
x = -2/3
このページへのコメント
Z4tu9s Thanks for the article post.Really looking forward to read more. Cool.