2018-11-14作业1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入你现在的工资");
string str_salar = Console.ReadLine();
Console.WriteLine("请输入你的年龄");
string str_age = Console.ReadLine();
double salar = 0;
int age = 0;
double sum = salar;
bool flag = true;
try
{
salar = Convert.ToDouble(str_salar);
age = Convert.ToInt32(str_age);
flag = true;
}
catch
{
Console.WriteLine("你输入的格式错误");
flag = false;
【2018-11-14作业1】}
if (flag)
{
while (age <= 65)
{
salar *= 1.05;
sum += salar;
age++;
}
Console.WriteLine("你到65岁退休之前的工资和是:{0}", sum);
}
Console.ReadKey();
}
}
}

    推荐阅读