Feb 14, 2002 #1 RollerMan Technical User Jan 27, 2002 6 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 Mar 30, 2001 1,440 US cout<<25/6<<"-"<<25%6<<"/"<<6<<endl; Matt Upvote 0 Downvote
Feb 18, 2002 #3 mmilan Programmer Jan 22, 2002 839 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;