1

私のアプリでは、例のイベントの人々の間で金額を共有する必要があります.RAM、RAJ、RAGHUのような3人の名前があり、RAMがイベントに10.00の金額を入れた場合10.00/3=3.333333

RAJ はRAM に支払う必要があります-------------3.33
RAGHU は RAM に支払う必要があります -------3.33

彼が得たすべてのイベントで他の2人から 6.66 here 0.1 行方不明 この問題を解決するにはどうすればよいですか 私は以下のように NumberStyle:NSNumberFormatterCurrencyStyle を使用しています

NSNumberFormatter *numberFormater = [[NSNumberFormatter alloc] init];
[numberFormater setLocale:[NSLocale currentLocale]];
[numberFormater setNumberStyle:NSNumberFormatterCurrencyStyle];
NSString *str_num = [numberFormater stringFromNumber:[NSNumber numberWithDouble:3.333333]];
[numberFormater release];
4

2 に答える 2

0

10 から RAM の分を差し引いてみませんか? 10 - 3.33 = 6.67。

于 2011-09-29T04:53:46.640 に答える
0
  float invoice= 10.15;
  int num_people = 3; // sample people
  float num_to_add;
  float piece_pie;
  // now just add num_to_add to your invoice then divide by num_people
  num_to_add=num_people*.01;
  invoice=invoice+num_to_add;
  piece_pie = invoice/num_people;
于 2011-09-29T05:07:48.843 に答える