using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace x180821汪敏 { class Program { static void Main(string[] args) { /*float a = 15.6f, b = 87.7f;\ String t; //注意:如果数据类型是单精度,那么赋值是值的后面加上字母f char sex = '男'; char ch = 'A'; String name = "张三"; //注意:输入语句默然输入的值是String类型的书 //t= Console.WriteLine(a); Console.WriteLine(b); Console.WriteLine(sex); Console.WriteLine(ch); Console.WriteLine(name);*/ String brand= "爱国者F928"; float weight = 12.4f; String type = "内置锂电池"; int price = 499; Console.WriteLine("品牌:"+brand); Console.WriteLine("重量:"+weight); Console.WriteLine("电池类型:"+type); Console.WriteLine("价格:"+price); int a = (int)(3.9 + 10); Console.WriteLine(a); String num1 ="1234"; double num2; num2 = System.Convert.ToDouble(num1)+1; Console.WriteLine(num2); double score1, score2, score3; Console.WriteLine("请输入STB的分数:"); score1=Convert.ToDouble(Console.ReadLine()); Console.WriteLine("请输入JAVA的分数:"); score2=Convert.ToDouble(Console.ReadLine()); Console.WriteLine("请输入SQL的分数:"); score3=Convert.ToDouble(Console.ReadLine()); Console.WriteLine("---------------------------------"); Console.WriteLine("STB" + "\t" + "JAVA" + "\t" + "SQL"); Console.WriteLine(score1 + "\t"+score2 + "\t"+score3); Console.WriteLine("---------------------------------"); double k, p; k = (score2 - score3); p = score1 + score2 + score3; Console.WriteLine("java课和sql课的分数之差:"+k); Console.WriteLine("3门课的平均分"+p); } } }
标签:Console,String,WriteLine,输入输出,System,score2,score3 From: https://www.cnblogs.com/bky-wang/p/18124596