public class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入语文成绩和数学成绩");
string x = Console.ReadLine();
int c = x.IndexOf(",");
if (c > 0)
{
int a = Convert.ToInt32(x.Substring(0, c));
int b = Convert.ToInt32(x.Substring(c + 1));
grades e = new grades(a, b);
Console.WriteLine(e.ce());
}
else {
Console.WriteLine("错误");
}
Console.ReadKey();
}
}
}
调用类
public class grades
{
public int a;
public int b;
//public bool yun(int a, int b) {
// if (a > 90 || b > 90)
// {
// return true;
// }
// else {
// return false;
// }
//}
public grades(int a,int b) {
this.a = a;
this.b = b;
}
public bool ce() {
if (this.a > 90 || this.b > 90)
{
return true;
}
else
{
return false;
}
}