บทความล่าสุด

12 กันยายน 2555

ตัวอย่าง การเขียนเมธอด และเรียกใช้เมธอด


1. จงเขียนโปรแกรมหาค่า f(x)โดยสมการf(x)เป็นดังนี้
f(x) = 3x2 + 2x + 7  if x <0
     = 0            if x = 0
     = x – 2        if x >0  
กำหนดให้ส่วนที่ใช้ในการคำนวณค่าf(x)อยู่ในฟังก์ชันget_Fxกำหนดให้ส่วนที่รับค่าตัวแปร Xจากคีย์บอร์ดและส่วนที่แสดงผลลัพธ์ของค่าf(x) อยู่ในฟังก์ชัน main

โปรแกรมหาจำนวณข้อมูลทั้งหมดกรณีที่เป็นรูปสามเหลี่ยม


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

namespace count
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Plase Input Base for glass : ");
            int numbase = int.Parse(Console.ReadLine());
            int result = 0;
            for (int i = numbase; i >= 0; i--)

โปรแกรมคำนวณหาเงินเดือน C#


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

namespace CalculateMoney
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Please input Money : ");
            double salary = int.Parse(Console.ReadLine());
            double totalSS = 0, totalCP, totalBN;

โค้ดแปลงเลขฐาน 2 , 8 ,10 และ 16 ภาษาซีชาร์ป C#

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

namespace FindBaseNumber
{
    class Program
    {
        public static void Main(string[] args)
        {