1

次のエラーが発生しました。 1:型または名前空間の名前 'CountDownTime'が名前空間 'System'に存在しません(アセンブリ参照がありません) 2:型または名前空間naem 'Runtime'が名前空間Andriod.OSに存在しませんネームスペースMonoDevelopエラー

私は10減算の質問を生成し、答えを提示し、その後、テストに費やした時間を与えるコードをしたいと思います。他のものと

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.CountDownTimer; 

using Android.App; 
using Android.Content; 
using Android.OS.Runtime; 
using Android.Runtime; 
using Android.Util; 
using Android.Views; 
using Android.Widget; 
using Android; 

namespace Jagtutor 
{ 
    public class Subtraction : View 
    { 
     public Subtraction (Context context, IAttributeSet attrs) : 
      base (context, attrs) 
     { 
      Initialize(); 
     } 

     public Subtraction (Context context, IAttributeSet attrs, int defStyle) : 
      base (context, attrs, defStyle) 
     { 
      Initialize(); 
     } 

     private void Initialize() 
     { 
      int correctCount; 
      int count = 0; 
      long startTime = CountDownTimer(0); 

      while (count < 10) 
      { 
       // Generate two random single-digit numbers 
       srand(CountDownTimer(0)); 
       int number1 = Random() % 10; 
       int number2 = Random() % 10; 

       // if number1 < number, swap number1 with number2 
       if (number1 < number2) 
       { 
        int temp = number1; 
        number1 = number2; 
        number2 = temp; 

        // PROMPT THE STUDENT TO ANSWER " WHAT IS NUMBERE1 - NUMBER2?" 
        Console.WriteLine("WHAT IS ")(number1);" - "(number2)("?"); 

        // Grade the answer and display the result 
        if (number1 - number2 == answer){ 
         Console.Write("You are correct!"); 
         correctCount++; 
        } 
        else 
         Console.WriteLine("Your answer is wrong"); 
        Console.WriteLine(number1);"-"(number2); " should be" (number1 - number2); 

        // increase the count 
        count++; 
       } 
       long endTime = CountDownTimer(0); 
       long testTime = endTime - startTime; 

       Console.Write(" Correct count is ")(correctCount);" Test time is" (testTime)("seconds"); 
       return 0; 
      } 

     } 
    } 

} 
+0

次の質問については、ここでコードをスタックオーバーフローでフォーマットする方法を学んでください。ここのコードフォーマッタはタブを好まないので、好ましくはスペースのみを使用します。編集ボックスにコードを貼り付けたら、コード全体を選択してCtrl + Kキーを押すか、編集ボックスの上の '{}'アイコンをクリックします。 –

答えて

0

、追加:

using Android.OS;

1

C#using directive名前空間、ない種類で使用されています。 System.CountDownTimer名前空間がないため、エラーです。

そのため、System.CountDownTimerタイプもありません。あなたが必要があると思いますので、それは、Android.OS.CountDownTimerです:

同様
using Android.OS; 

、何Android.OS.Runtime名前空間が存在しないので、using Android.OS.Runtime;もコンパイル時エラーが発生します。それを除く。