美文网首页
2018-11-08 C#工资计算器

2018-11-08 C#工资计算器

作者: f387b2061819 | 来源:发表于2018-11-08 11:13 被阅读0次

    纯手打牛逼程序
    工资计算器
    让我们算算裴裴工作到65岁能赚多少钱呢
    (无bug无敌版)

            {/***
              * 编写程序,
              * 估计一个职员在65岁退休之前能赚到多少钱。
              * 用年龄和超始薪水作为输入,
              * 并假设职员每年工资增长5%。
              * */
                double sum = 0;
                int age=0;
                double M=0;
                    Console.WriteLine("请输入年龄");
                        try{
                            age = Convert.ToInt32(Console.ReadLine());
                        }catch {
                            Console .WriteLine ("有误");
                        }
                    Console .WriteLine ("起始工资");
                        try{
                             M = Convert.ToInt32(Console.ReadLine());
                        }catch {
                            Console .WriteLine ("有误");
                        }
                        sum = M;
                    while (age<65 )
                        {
                        M=M*(1.05);
                        sum +=M ;
                        age++;
                        }
                    Console.WriteLine(sum);      
                    Console.ReadKey();
                
                    }```

    相关文章

      网友评论

          本文标题:2018-11-08 C#工资计算器

          本文链接:https://www.haomeiwen.com/subject/mxnixqtx.html