public class call
{
DateTime time = DateTime.Now;
public void check()
{
int count=0;
if(time < time.AddSeconds(30))
{
count ++;
if(count == 5)
{
Console.WriteLine(count);
}
}
public class Program
{
public static void Main(string[] args)
{
int input;
string sinput;
call one = new call();
call two = new call();
sinput = Console.ReadLine();
input = int.Parse(sinput);
do{
switch(input)
case 1: one.check();
break;
case 2: two.check();
break;
default: Console.WriteLine(":::");
break;
}while(input > 9)
}
}
}
我是新來的編程...我給輸入1至9 ..如果發生相同的輸入5次在30秒我要打印
我試圖打印如果數量發生在30秒內5次...... 我給輸入1至9 ..如果發生相同的輸入5次在30秒我想打印的..
請提供可編譯代碼 - 它是Java還是C#? –
我不知道如何爲對象創建做時間常量 – user8223535
@ user8223535爲什麼Java標籤呢? – shole