using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _6
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入一个正数");
//用户输入的数据
Double number=0;
while (true)
{
//为了避免输入字符而出错,增强程序强壮性
try
{
&nb
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _6
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入一个正数");
//用户输入的数据
Double number=0;
while (true)
{
//为了避免输入字符而出错,增强程序强壮性
try
{
&nb

该程序使用C#编写,接收用户输入的正数,通过判断小数部分是否大于0.5来决定四舍五入到个位的结果。如果输入的小数部分大于0.5,则向上取整;否则,保持不变。用户在输入错误时,程序会提示重新输入,增强了程序的健壮性。
最低0.47元/天 解锁文章
991





