-5

我正在尝试让程序开发数学问题,以便我的用户可以回答它们。我自己运行程序,它显示按钮供我点击,它们的数字在增加。谁能帮我解决这个问题。我关心的程序部分是 int Correctcount 的开始。请帮忙

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

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


namespace Jagtutor
{

    [Activity(Label = "Addition")]
    public class AdditionsActivity : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Create your application here
            SetContentView(Resource.Layout.Second);

            var label = FindViewById<TextView>(Resource.Id.screen3Label);
            label.Text = Intent.GetStringExtra("ModuleData") ?? "Data not available";

            {
            int correctCount = 0;
            int count = 0;

                 while (count < 10);
                {
                    Random gen = new Random();
                    int num1 = gen.Next();
                    int num2 = gen.Next(); 


                    Console.Write("What is");
                    Console.Write(num1);
                    Console.Write( " - ");
                    Console.Write( num2);
                    Console.Write( "?");
                    int answer = Int32.Parse(Console.ReadLine());

                    if (num1 + num2 == answer) {
                        Console.Write(" Your are Correct!\n");
                        correctCount++;

                    }
                    else
                        Console.Write( "Your answer is wrong" );
                        Console.Write(num1);
                        Console.Write(" + ");
                        Console.Write(num2);
                        Console.Write("should be ");
                        Console.Write(num1 + num2);
                        count++;
                }
            }

        }
    }

 }
4

1 回答 1

2

你会在 last 的主体周围缺少 { }else吗?

于 2012-04-27T21:13:07.077 回答