With trade_price
redefined to operate on trade
objectsinstead of on a price and number combinationyou can rewrite the
program in Segment 263 as follows:
#includestruct trade {double price; int number;}; double trade_price (struct trade t) {return t.price * t.number;} main ( ) { double price; int number; struct trade t; while (2 == scanf ("%lf%i", &price, &number)) { t.price = price; t.number = number; printf ("The total value of the trade is %f.\n", trade_price (t)); } } --- Data --- 2.5 500 --- Result --- The total value of the trade is 1250.000000.