Here is my code:
var num, totalNum, averageNum, numItems, msg;
msg = "";
totalNum = 0;
numItems = 0;
while(true)
{
num = get_integer("Please enter a number. Enter -99 to quit.", "type here");
totalNum += num;
numItems += 1;
if (num == -99)
{
totalNum += 99;
msg += "Total is: " +string(totalNum) +"#";
averageNum = real(totalNum / numItems);
msg += "Average is: " +string(averageNum);
show_message(msg);
break;
}
}
Right now, if I enter the number 1 and 2 and then -99 to break the loop, I get an average of 1. I want to get the real number, not the integer. Any help?