所以问题是我试图让这个程序用来输入单词中给出的数字。我经常得到一个非法的表达错误开始。 我是初学者,任何帮助将不胜感激。谢谢!
这是我的节目摘录
if(n>=1000)
{
System.out.println("OUT OF RANGE");
}
else
{
String result="", h=" ", t=" ", o=" ";
int a=0,b=0,c=0;
String ones[]= {"one","two","three","four","five","six","seven","eight","nine"};
String teens[]={"eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};
String tens[]={"ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};
if(n>=100 && n<1000)
{
a=n/100;
result = [a-1]+"hundred"; //the problem occurs here.
n=n%100;
}
答案 0 :(得分:1)
嗯。我发现了错误。抱歉浪费你的时间。
将是
<h1>Edit existing pictures </h1>
<% @pictures.each do |picture| %>
<%= image_tag picture.attachment_url(:thumb) %>
<%= link_to "Delete", picture_path(picture), method: :delete if user_signed_in? %>
<% end %>
来自
result = ones[a-1]+"hundred";
非常感谢。