using namespace std; float Return; float RETURNS( float p1, float p2) //calculates the return { Return = (p2 - p1)/p1; return Return; } struct stock{ //builds the overall struct char name[150]; float price1; float price2; float Return; }; stock list[10]; //our stocks values strcmp(list[1].name,"AT&T"); list[1].price1 = 4.50; list[1].price2 = 5.50; list[1].Return = RETURNS(list[1].price1,list[1].price2); strcmp(list[2].name,"FAB"); list[2].price1 = 10.50; list[2].price2 = 11.20; list[2].Return = RETURNS(list[2].price1,list[2].price2); |