本文介绍了纠正此程序中出现的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace feedbackformasp.net
{
class Program
{
static void Main(string[] args)
{
string cont;
do
{
Console.WriteLine("course list");
Console.WriteLine("1.c#:2.asp.net:3.ado.net");
//int ch= Convert.ToInt32 (Console.ReadLine());
}
here is the error
switch (Convert.ToInt32(Console.ReadLine()))
{
case 1:
Console.WriteLine("1. whether c# is too easy"+"\n"+"2.how many days coarse do u prefer"+"\n"+"3.which timings are preferable for u");
break;
case 2:
Console.WriteLine("1.coarse duration"+"\n"+"2.timings"+"3.syllabus cover");
break;
case 3:
Console.WriteLine("1.how do u feel ado.net"+"\n"+"2.thank you for ur interest");
break;
default:
Console.WriteLine("wrong choice");
break;
}
Console.WriteLine("do u want to continue to continue ? (Y/N): ");
cont = Console.ReadLine();
while(cont=="Y"||cont=="y");
Console.ReadLine();
}
}
}
推荐答案
static void Main(string[] args)
{
string cont;
do
{
Console.WriteLine("course list");
Console.WriteLine("1.c#:2.asp.net:3.ado.net");
//int ch= Convert.ToInt32 (Console.ReadLine());
switch (Convert.ToInt32(Console.ReadLine()))
{
case 1:
Console.WriteLine("1. whether c# is too easy"+"\n"+"2.how many days coarse do u prefer"+"\n"+"3.which timings are preferable for u");
break;
case 2:
Console.WriteLine("1.coarse duration"+"\n"+"2.timings"+"3.syllabus cover");
break;
case 3:
Console.WriteLine("1.how do u feel ado.net"+"\n"+"2.thank you for ur interest");
break;
default:
Console.WriteLine("wrong choice");
break;
}
Console.WriteLine("do u want to continue to continue ? (Y/N): ");
cont = Console.ReadLine();
}
while(cont=="Y"||cont=="y");
Console.ReadLine();
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace feedbackformasp.net
{
class Program
{
static void Main(string[] args)
{
string cont;
do
{
Console.WriteLine("course list");
Console.WriteLine("1.c#:2.asp.net:3.ado.net");
switch (Convert.ToInt32(Console.ReadLine()))
{
case 1:
Console.WriteLine("1. whether c# is too easy" + "\n" + "2.how many days coarse do u prefer" + "\n" + "3.which timings are preferable for u");
break;
case 2:
Console.WriteLine("1.coarse duration" + "\n" + "2.timings" + "3.syllabus cover");
break;
case 3:
Console.WriteLine("1.how do u feel ado.net" + "\n" + "2.thank you for ur interest");
break;
default:
Console.WriteLine("wrong choice");
break;
}
Console.WriteLine("do u want to continue to continue ? (Y/N): ");
cont = Console.ReadLine();
}
while (cont == "Y" || cont == "y");
Console.ReadLine();
}
}
}
这篇关于纠正此程序中出现的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!