@@ -45,7 +45,7 @@ void print_frac(Fraction const &m) {
4545 cout << m.numerator ;
4646 }
4747 if (m.sqrt != 1 && m.numerator != 0 ) {
48- cout << " √ " << m.sqrt ;
48+ cout << SQRT_CH << m.sqrt ;
4949 }
5050 if (m.denominator != 1 && m.numerator != 0 ) {
5151 cout << " /" << m.denominator ;
@@ -55,9 +55,9 @@ void print_frac(Fraction const &m) {
5555Error load_frac (string s, Fraction &m) {
5656 if (s.find (" /" ) == string::npos) {
5757 m.denominator = 1 ;
58- if (s.find (" √ " ) != string::npos) {
59- m.sqrt = stoi (s.substr (s.find (" √ " ) + 3 ));
60- string num = s.substr (0 , s.find (" √ " ));
58+ if (s.find (SQRT_CH ) != string::npos) {
59+ m.sqrt = stoi (s.substr (s.find (SQRT_CH ) + SQRT_LEN ));
60+ string num = s.substr (0 , s.find (SQRT_CH ));
6161 if (num.length () == 0 ) m.numerator = 1 ;
6262 else if (num.length () == 1 && num[0 ] == ' -' ) m.numerator = -1 ;
6363 else m.numerator = stoi (num);
@@ -67,9 +67,9 @@ Error load_frac(string s, Fraction &m) {
6767 }
6868 } else {
6969 string top = s.substr (0 , s.find (" /" ));
70- if (top.find (" √ " ) != string::npos) {
71- m.sqrt = stoi (top.substr (top.find (" √ " ) + 3 ));
72- string num = top.substr (0 , top.find (" √ " ));
70+ if (top.find (SQRT_CH ) != string::npos) {
71+ m.sqrt = stoi (top.substr (top.find (SQRT_CH ) + SQRT_LEN ));
72+ string num = top.substr (0 , top.find (SQRT_CH ));
7373 if (num.length () == 0 ) m.numerator = 1 ;
7474 else if (num.length () == 1 && num[0 ] == ' -' ) m.numerator = -1 ;
7575 else m.numerator = stoi (num);
0 commit comments