正如标题中所说,我在方程式部分的代码中得到了非法的表达式开头。我确实相信我把一切都做对了,但我仍然有一个非法的表达开始。
public class FacebookUsers
{
public static void main(String[] args)
{
int months = 1;
for ( int people = 500000000; people < 2000000000; months ++)
{
people = (peoplestart) * ((1.05)**(months));
}
System.out.println("It took "+months+" to reach one billion users on "
+ "facebook at the rate of 5% growth.");
months = 1;
for ( int people = 500000000; people < 2000000000; months ++)
{
people = people * ((1.05)**(months));
}
System.out.println("It took "+months+" to reach two billion users on "
+ "facebook at the rate of 5% growth.");
}
}
任何帮助表示赞赏,并提前感谢您。