看一个C#程序 哪里错了?

来源:百度知道 编辑:UC知道 时间:2024/05/16 16:16:35
class Program
{
static void Main(string[] args)
{
int[] array={1,2,4,6,8,9};
foreach (int i in array )
if (array % 2 == 0)
Console.WriteLine("{0}", i);
}
}
错误信息: 运算符“%”无法应用于“int[]”和“int”类型的操作数

一楼真笑人``提什么狗P java```你java也不懂!修饰符```public```哈哈
楼主错误很明显

if (i % 2 == 0)
改这句就OK 我想你是笔误``

C#没怎么用过..
从java的角度话:
class 应该 public
static void Main 应该 public static void Main

你应该把出错信息写出来.....

我在给你一个帮我看哈嘛~!@echo off
echo 正在清除系统垃圾文件,请稍等......
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Setting