當我嘗試編譯它,我得到一個錯誤「;」在線我嘗試程序釐米英寸/英尺 - 英寸到釐米,米
double cm1 (inch_to_cm*2.54);
它必須在相同的窗口:cm到英寸/英寸到釐米/米。
import java.util.Scanner;
public class Centimer_Inch
{
public static void main (String[] args)
{
// 2.54cm is 1 inch
Scanner cm = new Scanner(System.in); //Get INPUT from pc-Keyboard
System.out.println("Enter The Centimeters:"); // Write input
double centimeters = cm.nextDouble(); // STAM מקבל את הסנטימטר
double inches = Math.round((centimeters/2.54) * 100)/100.0; // STAM לוקח את הסנטימטר ומחלק ב2.54
System.out.println(inches +"Inches");
double foot=Math.round((inches/12) *100)/100.0;
System.out.print(foot +"Foots");
// inch to cm
Scanner inch1 = new Scanner(System.in);
System.out.println("Enter The Inch");
double inch_to_cm = inch1.nextDouble();
double cm1 (inch_to_cm*2.54); //From INCH TO CM
System.out.println(inch_to_cm);
}
}
你缺少一個'=' –
和我可怎麼辦輸入釐米英寸。\ FOOT 英寸之間的空間爲cm – Alex
見我給這裏的答案http://stackoverflow.com/a/13211447/57695 –