尝试在某些学校项目中使用java进行订购系统,但在编译时出错。
我非常需要你的帮助。请; - ;
这是错误: Picture error
我在这里有以下源代码:
public class fastfood {
public static void main(String[] args){
int quantity,total,price1,price2;
Scanner reader = new Scanner(System.in);
System.out.println("\t\t Welcome to fastfood restaurant!\t\t");
System.out.println(" ");
System.out.println(" ");
System.out.println("\t\t\t\tMENU\t\t\t\t");
System.out.println(" ");
System.out.println(" Order code\t\t Meal\t\t\t\t Price ");
System.out.println(" ");
System.out.println(" (A1) \t\t Burger\t\t\t\t P30");
System.out.println(" (A2) \t\t Spaghetti\t\t\t P80");
System.out.println(" (B1) \t\t Peach mango pie\t\t P40");
System.out.println(" (B2) \t\t Chicken meal\t\t\t P100");
System.out.println(" (C1) \t\t Hotdog sandwich\t\t P30");
System.out.println(" (C2) \t\t Fries\t\t\t\t P20");
System.out.println(" (D1) \t\t Ice cream\t\t\t P25");
System.out.println(" (D2) \t\t Water\t\t\t\t P15");
System.out.println(" ");
System.out.println(" ");
do{
System.out.println("Enter your name: ");
String name = reader.nextLine();
System.out.println("Enter your order(Code): ");
String order = reader.nextLine();
if(order("A1")){
price1 = 30;
System.out.println("Order description: Burger");
}
else if(order("A2")){
price1 = 80;
System.out.println("Order description: Spaghetti");
}
System.out.print("Enter Quantity: ");
quantity1 = reader.nextLine();
total += price1 * quantity1;
System.out.println("Another Order? (Y/N) : ");
again = reader.nextLine();
if (again("y")){
} loop1=loop1+1;
} while (loop1==1);
}
}
}
答案 0 :(得分:1)
您忘记关闭上一个AhmadsMacbookPro:NVIDIA_CUDA-5.5_Samples iartist93$ make
/Developer/NVIDIA/CUDA-5.5/bin/nvcc -ccbin g++ -I../../common/inc -m64 -Xcompiler -arch -Xcompiler x86_64 -gencode arch=compute_10,code=sm_10 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=\"sm_35,compute_35\" -o asyncAPI.o -c asyncAPI.cu
2016-03-12 21:16:13.470 xcodebuild[1278:29992] [MT] PluginLoading: Required plug-in compatibility UUID 9AFF134A-08DC-4096-8CEE-62A4BB123046 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Unity4XC.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-03-12 21:16:13.473 xcodebuild[1278:29992] Failed to load plugin at: /Users/iartist93/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Unity4XC.xcplugin, skipping. Reason for failure: *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]
2016-03-12 21:16:15.958 xcodebuild[1281:30115] [MT] PluginLoading: Required plug-in compatibility UUID 9AFF134A-08DC-4096-8CEE-62A4BB123046 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Unity4XC.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-03-12 21:16:15.959 xcodebuild[1281:30115] Failed to load plugin at: /Users/iartist93/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Unity4XC.xcplugin, skipping. Reason for failure: *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]
clang: error: unsupported option '-dumpspecs'
clang: error: no input files
make[1]: *** [asyncAPI.o] Error 1
make: *** [0_Simple/asyncAPI/Makefile.ph_build] Error 2
声明
if
因此,编译器将'do ... while'中的括号视为if (again("y")) {
loop1=loop1+1;
}
语句的结束括号
我建议你下次正确缩进你的代码。当你这样做时,答案会在你眼前跳跃。
如果您正在使用Eclipse,请选择所有代码(Ctrl + A),然后按if
。 Eclipse将处理缩进