标签:col subject temp task tput 一个 original static coder
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace G1 { class Program { static void Main(string[] args) { string myWords = Hello(); Console.WriteLine(myWords); } /********** Begin *********/ static string Hello() { return "Hello World, this is my function!"; } /********** End *********/ } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace G2 { class Program { static void Main(string[] args) { int[] a = { 3, 4, 33, 2, 121, 34, 65, 34 }; int size = a.Length - 1; int result = Max(a, size); Console.WriteLine(result); } /********** Begin *********/ static int Max(int[] array, int i) { int temp; if (i == 0) { return array[0]; } else { temp = Max(array, i - 1); if (temp > array[i]) { return temp; } else { return array[i]; } } } /********** End *********/ } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace G3 { class Program { static void Main(string[] args) { outputDiscount(); } /********** Begin *********/ static int originalPrice = 100; static float discount = 0.73F; static void outputDiscount() { Console.WriteLine("After discounting, the price is " + originalPrice * discount); } /********** End *********/ } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace G4 { class Program { static void Main(string[] args) { int totalPrice = 100; ; /********** Begin *********/ int originalPrice = 100; float discount = 0.73F; /********** End *********/ outputDiscount(originalPrice, discount, ref totalPrice); Console.WriteLine("main totalPrice is " + totalPrice); } /********** Begin *********/ static void outputDiscount(int orgPrice, float dis,ref int total) { total = (int)(orgPrice * dis); Console.WriteLine("After discounting, the price is " + total); } /********** End *********/ } }
标签:col subject temp task tput 一个 original static coder
原文地址:https://www.cnblogs.com/QQ1723545340/p/13131139.html