.NET Logo
Welcome Guest Search | Active Topics | Members | Log In | Register

เขียนใน console เขียนอย่างไรคับ Options · View
zerozaaa
Posted: Monday, October 27, 2008 5:55:54 PM
Rank: มือพระกาฬ
Groups: Member

Joined: 6/13/2008
Posts: 80

อยากเขียน โดยมี คลาส ที่มี เมธอด ประมวลผล โดยส่งค่าจาก อีกหน้าหนึ่งไปประมวลผลใน คลาสนี้ โดยส่งค่าไปประมวลผลใน เมธอด
ทำการ มี 2 เมธอด  คือคำนวนพื้นที่ 3 เหลื่ยม กับพื้นที่ 4 เหลี่ยม ช่วยเขียนให้ดูทีคับ

zerozaaa
Posted: Monday, October 27, 2008 11:54:46 PM
Rank: มือพระกาฬ
Groups: Member

Joined: 6/13/2008
Posts: 80

ถามเองเขียนเอง  ลองทำดูแล้ว มันได้แล้วคับ

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication1
{
    public class TestMethod
    {
        public double triangle(double Height, double Width)
        {
            return 0.5*(Height * Width);
        }
        public double Square(double Height, double Width)
        {
            return Height * Width;
        }
        public static void Main()
        {
            TestMethod tm = new TestMethod();
            Console.WriteLine("Triangle 1/2 x height x Width " + tm.triangle(15, 7));
            Console.WriteLine("Square height x width " + tm.Square(6, 7));
            Console.ReadLine();
        }
    }
}
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.


Sponsored by