Feb 14, 2002 #1 RollerMan Technical User Joined Jan 27, 2002 Messages 6 Location US Anyone familar with mixed fractions? I understand how to reduce them to lowest terms but now I am trying to figure out how to convert it to a mixed number. example: 25/6= 4-1/6 any clues?
Anyone familar with mixed fractions? I understand how to reduce them to lowest terms but now I am trying to figure out how to convert it to a mixed number. example: 25/6= 4-1/6 any clues?
Feb 15, 2002 #2 Zyrenthian Programmer Joined Mar 30, 2001 Messages 1,440 Location US cout<<25/6<<"-"<<25%6<<"/"<<6<<endl; Matt Upvote 0 Downvote
Feb 18, 2002 #3 mmilan Programmer Joined Jan 22, 2002 Messages 839 Location GB cout << int(a/b) << "-" << a%b << "/" << b <<endl; Of course, that's going to look a bit silly if a%b is 0. Perhaps something along the lines of: cout << int(a/b); if (a%b) { cout << "-" << a%b << "/" << b; } cout << endl; Upvote 0 Downvote
cout << int(a/b) << "-" << a%b << "/" << b <<endl; Of course, that's going to look a bit silly if a%b is 0. Perhaps something along the lines of: cout << int(a/b); if (a%b) { cout << "-" << a%b << "/" << b; } cout << endl;