C#第三章学习代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _3._1变量
{
    class Program
    {
        static void Main(string[] args)
        {

            Console.WriteLine("学习变量的存储");
            //double a = 1, b = 2, c = 3, d = 4;

            //Console.WriteLine(a);
            //Console.WriteLine(b);
            //Console.WriteLine(c);
            //Console.WriteLine(d);
            //a = 50;
            //Console.WriteLine(a);
            //int a = 95;
            //Console.WriteLine(a);
            double num = 36.6;
           
            Console.WriteLine("num");


            Console.ReadKey();
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _3._2常量
{
    class Program
    {
        static void Main(string[] args)
        {
            double r = 5;
            const double pi=3.14;
            Console.WriteLine("此圆的周长是"+2*pi*r);
            Console.WriteLine("此圆的面积是"+pi*pi*r);//输出一行,并下移光标

            Console.Write(@"是个什么东西\n");//只输出,不下移光标 转义字符\n
            Console.Write("光标在哪里");

            string strSQL = @"SELECT * FROM HumanResources.Employee AS e
 INNER JOIN Person.Contact AS c
  ON e.ContactID = c.ContactID
  ORDER BY c.LastName";



            Console.ReadKey();
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _3._4值类型
{
    class Program
    {
        static void Main(string[] args)
        {
            int INT = 123;
            char CHAR = 'a';
            string STRING = "我要自学网";
            object OBJECT = 1024;
                Console.WriteLine(INT);
            Console.WriteLine(CHAR);
            Console.WriteLine(STRING);
            Console.WriteLine(OBJECT);
            Console.ReadKey();
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _3._5任务实施
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.WriteLine("我要自学网很强大");
            //Console.ReadKey();

            //Console.WriteLine("请输入你喜欢吃的水果");
            //string fruit = Console.ReadLine();
            //Console.WriteLine("哈哈这么巧,我也喜欢吃"+fruit);
            //Console.ReadKey();

            //Console.WriteLine("请输入您的姓名");
            //string Name = Console.ReadLine();
            //Console.WriteLine("请输入性别");
            //string Gender = Console.ReadLine();
            //Console.WriteLine("您几岁了");
            //string Age = Console.ReadLine();
            //Console.WriteLine("您好,{0}!!您是{1}生,您{2}岁了",Name,Gender,Age);
            //Console.ReadKey();
            //ConsoleReadLine();用于接受用户的输入 ,输入类型默认为字符串string类型
            //ConsoleWriteLine();双引号中的内容可原样输出,但是转义字符及索引号{i}除外,索此号必须从零不间断地顺延
            Console.WriteLine("今年我5岁了\n我是男生\n我可以上学了");
            Console.ReadKey();
        }
    }
}

  

 

posted @ 2016-03-30 20:27  前缘Q+7589848  阅读(279)  评论(0编辑  收藏  举报