herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
你會用C的算子sizeof?
-
XOR prefixsum CPP python解Leetcode 1829 Maximum XOR for Each Query 其實這裡考慮的是元素個數為2^maximumBit的交換群,運算子為XOR。 [Python code請進]
-
Python C++使用字串find迴圈速解Leetcode 2490 Circular Sentence C++ & Python都有字串的find,用法都類似 split=s.find(' ', split+1)能找到s從index=split+1開...
66 則留言:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace test0610
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h,double _w,string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("寫一個物件導向的程式,可算一群人的BMI。");
Person[] XX = new Person[3];
XX[0] = new Person(158,41,"清姬");
XX[1] = new Person(152,44, "阿比蓋爾·威廉斯");
XX[2] = new Person(162,51, "葛飾北齋");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("========================");
}
Console.Read();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace T0610
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列人的bmi。");
Person [] XX = new Person[3];
XX[0] = new Person();
XX[1] = new Person("喬瑟夫·喬斯達", 'm', 195, 97);
XX[2] = new Person("Emiya archer", 'm', 187, 78);
foreach(Person X in XX)
{
X.print();
}
Console.Read();
}
}
class Person
{
string name = "阿爾托莉亞·潘德拉剛";
char sex = 'f';
double h = 154;
double w = 42;
public void print()
{
Console.WriteLine("name:" + name);
Console.WriteLine("sex:" + sex);
Console.WriteLine("h:" + h);
Console.WriteLine("w:" + w);
Console.WriteLine("bmi:" + bmi());
Console.WriteLine("=====================");
}
public void looseWeight(double ww)
{
w -= ww;
}
double bmi()
{
return 10000.0 * w / (h * h);
}
public Person() { }
public Person(string _name, char _sex, double _h, double _w)
{
name = _name;
sex = _sex;
h = _h;
w = _w;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("....");
Person[] XX = new Person[3];
XX[0] = new Person(170, 55, "A momomomomo~");
XX[1] = new Person(180, 65, "zzzzzz");
XX[2] = new Person(173, 87, "aaaaaa");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Alice");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 70, "Carl");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("==============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi
{
class Program
{
class Person
{
double h,w;
string name;
public double bmi()
{
return 10000.0 * w/(h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person (double _h,double _w,string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Alice");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 70, "Carl");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Bmi_oop
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("AI幫你算一群人的BMI!");
Person [] XX = new Person[4];
XX[0] = new Person();
XX[1] = new Person("阿金", 'm', 174, 60);
XX[2] = new Person("阿銀", 'm', 178, 65);
XX[3] = new Person("阿星", 'm', 180, 75);
foreach (Person X in XX)
{
X.print();
}
Console.Read();
}
}
class Person
{
string name = "張阿明";
char sex = 'f';
double h = 160;
double w = 50;
public void print()
{
Console.WriteLine("name:" + name);
Console.WriteLine("sex:" + sex);
Console.WriteLine("h:" + h);
Console.WriteLine("w:" + w);
Console.WriteLine("bmi:" + bmi());
Console.WriteLine("================");
}
public void looseweight(double ww)
{
w -= ww;
}
double bmi()
{
return 10000.0 * w / (h * h);
}
public Person() { }
public Person(string _name,char _sex,double _h,double _w)
{
name = _name;
sex = _sex;
h = _h;
w = _w;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
class Person
{
Double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(170,60,"MapleRD");
XX[1] = new Person(178, 90, "fire sister");
XX[2] = new Person(165, 70, "fatfat");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BMI_oop
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("練習POP");
Person[] XX = new Person[3];
XX[0] = new Person(180, 70, "Alex");
XX[1] = new Person(160, 46, "Emma");
XX[2] = new Person(165, 50, "John");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("bmi="+X.bmi());
Console.WriteLine("==========");
}
Console.ReadKey();
}
}
}
using System;
namespace ConsoleApp1
{
class Program
{
class person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public person() { }
public person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class program
{
static void Main(string[] args)
{
Console.WriteLine("練習oop");
person x = new person(165, 55, "Alice");
x.print();
Console.WriteLine("bmi=" + x.bmi());
Console.ReadKey();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h,double _w,string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person X = new Person(165, 55, "Alice");
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name="+name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("練習Top");
Person[] XX = new Person[3];
XX [0] = new Person(165, 68, "Alice");
XX [1] = new Person(178, 90, "John");
XX[2] = new Person(175, 70, "Carl");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace T0610
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列人的bmi。");
Person [] XX = new Person[3];
XX[0] = new Person();
XX[1] = new Person("DanDan", 'm', 190, 69);
XX[2] = new Person("BuBu", 'm', 187, 65);
foreach(Person X in XX)
{
X.print();
}
Console.Read();
}
}
class Person
{
string name = "shuoyenjyun";
char sex = 'f';
double h = 160;
double w = 50;
public void print()
{
Console.WriteLine("name:" + name);
Console.WriteLine("sex:" + sex);
Console.WriteLine("h:" + h);
Console.WriteLine("w:" + w);
Console.WriteLine("bmi:" + bmi());
Console.WriteLine("====================");
}
public void looseWeight(double ww)
{
w -= ww;
}
double bmi()
{
return 10000.0 * w / (h * h);
}
public Person() { }
public Person(string _name, char _sex, double _h, double _w)
{
name = _name;
sex = _sex;
h = _h;
w = _w;
}
}
}
using System;
namespace ConsoleApp1
{
class Program
{
class person
{
double h, w;
String name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public person() { }
public person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
person[] XX = new person[3];
XX[0] = new person(150, 45, "Alice");
XX[1] = new person(178, 90, "John");
XX[2] = new person(175, 60, "Carl");
foreach (person X in XX)
{
X.print();
Console.WriteLine("BMI=" + X.bmi());
Console.WriteLine("==============");
}
Console.ReadKey();
}
}
}
using System;
namespace ConsoleApp1
{
class Program
{
class person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public person() { }
public person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
person[] XX = new person[3];
XX[0] = new person(150, 45, "Alice");
XX[1] = new person(178, 90, "John");
XX[2] = new person(175, 60, "Carl");
foreach(person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace T0610
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列人的bmi。");
Person [] XX = new Person[3];
XX[0] = new Person();
XX[1] = new Person("DanDan", 'm', 190, 69);
XX[2] = new Person("BuBu", 'm', 187, 65);
foreach(Person X in XX)
{
X.print();
}
Console.Read();
}
}
class Person
{
string name = "saber";
char sex = 'f';
double h = 160;
double w = 50;
public void print()
{
Console.WriteLine("name:" + name);
Console.WriteLine("sex:" + sex);
Console.WriteLine("h:" + h);
Console.WriteLine("w:" + w);
Console.WriteLine("bmi:" + bmi());
Console.WriteLine("====================");
}
public void looseWeight(double ww)
{
w -= ww;
}
double bmi()
{
return 10000.0 * w / (h * h);
}
public Person() { }
public Person(string _name, char _sex, double _h, double _w)
{
name = _name;
sex = _sex;
h = _h;
w = _w;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
class Person
{
Double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(170,60,"MapleRD");
XX[1] = new Person(178, 90, "fire sister");
XX[2] = new Person(165, 70, "fatfat");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
class Person
{
Double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(170,60,"MapleRD");
XX[1] = new Person(178, 90, "fire sister");
XX[2] = new Person(165, 70, "fatfat");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("============");
}
Console.ReadKey();
}
}
}
using System;
namespace ConsoleApp1
{
class Program
{
class person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public person() { }
public person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
person[] XX = new person[3];
XX[0] = new person(150, 45, "Alice");
XX[1] = new person(178, 90, "John");
XX[2] = new person(175, 60, "Carl");
foreach(person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
using System;
namespace ConsoleApp1
{
class Program
{
class person
{
double h, w;
String name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public person() { }
public person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
person[] XX = new person[3];
XX[0] = new person(150, 45, "Alice");
XX[1] = new person(178, 90, "John");
XX[2] = new person(175, 60, "Carl");
foreach (person X in XX)
{
X.print();
Console.WriteLine("BMI=" + X.bmi());
Console.WriteLine("==============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
class Person
{
Double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(170,60,"MapleRD");
XX[1] = new Person(178, 90, "fire sister");
XX[2] = new Person(165, 70, "fatfat");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _0610
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列人的bmi");
Person[] XX = new Person[3];
XX[0] = new Person();
XX[1]= new Person("小小", 'm', 170, 69);
XX[2] = new Person("小黑", 'm', 189, 69);
foreach (Person X in XX)
{
X.print();
}
Console.Read();
}
}
class Person
{
string name = "王小美";
char sex = 'f';
double h = 160;
double w = 50;
public void print()
{
Console.WriteLine("name:" + name);
Console.WriteLine("sex:" + sex);
Console.WriteLine("h:" + h);
Console.WriteLine("w:" + w);
Console.WriteLine("bmi:" + bmi());
Console.WriteLine("=============");
}
public void looseWeight(double ww)
{
w -= ww;
}
double bmi()
{
return 10000.0 * w / (h * h);
}
public Person() { }
public Person(string _name, char _sex, double _h, double _w)
{
name = _name;
sex = _sex;
h = _h;
w = _w;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("練習oop");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Alice");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 70, "Carl");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
class Person
{
Double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(170,60,"MapleRD");
XX[1] = new Person(178, 90, "fire sister");
XX[2] = new Person(165, 70, "fatfat");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
class Person
{
Double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(170,60,"MapleRD");
XX[1] = new Person(178, 90, "fire sister");
XX[2] = new Person(165, 70, "fatfat");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("練習oop");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Alice");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 70, "Carl");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("BMI");
Person[] XX = new Person[3];
XX[0] = new Person();
XX[1] = new Person("BB", 'm', 173, 65);
XX[2] = new Person("COCO", 'f', 170, 61);
foreach (Person X in XX)
{
X.print();
}
Console.Read();
}
}
class Person
{
string name="CNN";
char sex = 'f';
double h = 160;
double w = 50;
public void print()
{
Console.WriteLine("name:" + name);
Console.WriteLine("sex:" + sex);
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("bmi=" + bmi());
Console.WriteLine("===============");
}
public void looseWeight(double ww)
{
w -= ww;
}
double bmi()
{
return 10000.0 * w / (h * h);
}
public Person() { }
public Person(string _name, char _sex, double _h, double _w)
{
name = _name;
sex = _sex;
h = _h;
w = _w;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
class Person
{
Double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(170,60,"MapleRD");
XX[1] = new Person(178, 90, "fire sister");
XX[2] = new Person(165, 70, "fatfat");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Alice");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 70, "Carl");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("==============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
class Person
{
Double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(170,60,"MapleRD");
XX[1] = new Person(178, 90, "fire sister");
XX[2] = new Person(165, 70, "fatfat");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Mary");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 78, "Vick");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi
{
class Program
{
class Person
{
double h,w;
string name;
public double bmi()
{
return 10000.0 * w/(h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person (double _h,double _w,string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Alice");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 70, "Carl");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Mary");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 78, "Vick");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("練習oop");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Alice");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 70, "Carl");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Mary");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 78, "Vick");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Mary");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 78, "Vick");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Mary");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 78, "Vick");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi_oop
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("BMI");
Person[] XX = new Person[3];
XX[0] = new Person(163, 55, "Selina");
XX[1] = new Person(160, 50, "Hebe");
XX[2] = new Person(165, 55, "Ella");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("____________________________");
}
Console.ReadKey();
}
}
}
using System;
namespace ConsoleApp2
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() {}
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
static void Main(string[] args)
{
Console.WriteLine("練習用OOP");
Person[] XX = new Person[3];
XX[0] = new Person(165,68,"alice");
XX[1]= new Person(190, 80, "zoe");
XX[2]= new Person(180, 60, "john");
foreach (Person x in XX)
{
x.print();
Console.WriteLine("bmi=" + x.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Mary");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 78, "Vick");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Mary");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 78, "Vick");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
}
using System;
namespace ConsoleApp2
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() {}
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
static void Main(string[] args)
{
Console.WriteLine("練習用OOP");
Person[] XX = new Person[3];
XX[0] = new Person(165,68,"alice");
XX[1]= new Person(190, 80, "zoe");
XX[2]= new Person(180, 60, "john");
foreach (Person x in XX)
{
x.print();
Console.WriteLine("bmi=" + x.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
using System;
namespace ConsoleApp2
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() {}
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
static void Main(string[] args)
{
Console.WriteLine("練習用OOP");
Person[] XX = new Person[3];
XX[0] = new Person(165,68,"alice");
XX[1]= new Person(190, 80, "zoe");
XX[2]= new Person(180, 60, "john");
foreach (Person x in XX)
{
x.print();
Console.WriteLine("bmi=" + x.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi_oop
{
class Program
{
static void Main(string[] args)//控制
{
Console.WriteLine("寫一個物件導向程式,要做什麼?算一陣列的BMI。");
Person [] XX = new Person [3];
XX[0] = new Person();
XX[1] = new Person("小小", 'm', 170, 69);
XX[2] = new Person("小王", 'm', 179, 79);
foreach (Person X in XX)
{
X.print();
}
Console.Read();
}
}
class Person
{
string name="王小美";
char sex='f';
double h = 160;
double w = 50;
public double bmi()//算bmi
{
return 10000.0 * w / (h * h);
}
public void print()//格式
{
Console.WriteLine("name=" + name);
Console.WriteLine("sex=" + sex);
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("bmi" + bmi());
Console.WriteLine("====================");
}
public Person() { }//列印
public Person(string _name, char _sex,double _h,double _w)
{
name = _name;
sex = _sex;
h = _h;
w = _w;
}
}
}
using System;
namespace ConsoleApp2
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() {}
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
static void Main(string[] args)
{
Console.WriteLine("練習用OOP");
Person[] XX = new Person[3];
XX[0] = new Person(165,68,"alice");
XX[1]= new Person(190, 80, "zoe");
XX[2]= new Person(180, 60, "john");
foreach (Person x in XX)
{
x.print();
Console.WriteLine("bmi=" + x.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
using System;
namespace ConsoleApp2
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() {}
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
static void Main(string[] args)
{
Console.WriteLine("練習用OOP");
Person[] XX = new Person[3];
XX[0] = new Person(165,68,"alice");
XX[1]= new Person(190, 80, "zoe");
XX[2]= new Person(180, 60, "john");
foreach (Person x in XX)
{
x.print();
Console.WriteLine("bmi=" + x.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
using System;
namespace ConsoleApp2
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() {}
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
static void Main(string[] args)
{
Console.WriteLine("練習用OOP");
Person[] XX = new Person[3];
XX[0] = new Person(165,68,"alice");
XX[1]= new Person(190, 80, "zoe");
XX[2]= new Person(180, 60, "john");
foreach (Person x in XX)
{
x.print();
Console.WriteLine("bmi=" + x.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi02
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("BMI練習");
Person[] XX= new Person[3];
XX[0] = new Person(173, 87, "Big Pack01");
XX[1] = new Person(173, 90, "Big Pack02");
XX[2] = new Person(173, 93, "Big Pack03");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("sex:" + 'm');
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("=================");
}
Console.ReadKey();
}
}
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("name=" + name);
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
}
public void looseWeight(double ww)
{
w -= ww;
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
class Person
{
Double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(170,60,"MapleRD");
XX[1] = new Person(178, 90, "fire sister");
XX[2] = new Person(165, 70, "fatfat");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
class Person
{
Double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(170,60,"MapleRD");
XX[1] = new Person(178, 90, "fire sister");
XX[2] = new Person(165, 70, "fatfat");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi02
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("BMI練習");
Person[] XX= new Person[3];
XX[0] = new Person(173, 87, "Big Pack01");
XX[1] = new Person(173, 90, "Big Pack02");
XX[2] = new Person(173, 93, "Big Pack03");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("sex:" + 'm');
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("=================");
}
Console.ReadKey();
}
}
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("name=" + name);
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
}
public void looseWeight(double ww)
{
w -= ww;
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi_oop
{
class Program
{
static void Main(string[] args)//控制
{
Console.WriteLine("寫一個物件導向程式,要做什麼?算一陣列的BMI。");
Person [] XX = new Person [3];
XX[0] = new Person();
XX[1] = new Person("小小", 'm', 170, 69);
XX[2] = new Person("小王", 'm', 179, 79);
foreach (Person X in XX)
{
X.print();
}
Console.Read();
}
}
class Person
{
string name="王小美";
char sex='f';
double h = 160;
double w = 50;
public double bmi()//算bmi
{
return 10000.0 * w / (h * h);
}
public void print()//格式化
{
Console.WriteLine("name=" + name);
Console.WriteLine("sex=" + sex);
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("bmi" + bmi());
Console.WriteLine("====================");
}
public Person() { }//列印
public Person(string _name, char _sex,double _h,double _w)
{
name = _name;
sex = _sex;
h = _h;
w = _w;
}
}
}
使用系統;
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;
使用System.Threading.Tasks;
名稱空間bmi02
{
類程序
{
靜態void Main(string [] args)
{
Console.WriteLine(“ BMI練習”);
Person [] XX =新的Person [3];
XX [0] =新人物(173,87,“ Big Pack01”);
XX [1] =新人物(173,90,“ Big Pack02”);
XX [2] =新人(173、93,“ Big Pack03”);
foreach(XX中的人X)
{
X.print();
Console.WriteLine(“ sex:” +'m');
Console.WriteLine(“ bmi =” + X.bmi());
Console.WriteLine(“ =================);
}
Console.ReadKey();
}
}
類Person
{
double h,w;
字符串名稱;
public double bmi()
{
返回10000.0 * w /(h * h);
}
public void print()
{
Console.WriteLine(“ name =” + name);
Console.WriteLine(“ h =” + h);
Console.WriteLine(“ w =” + w);
}
public voidlackWeight(double ww)
{
w-= ww;
}
public Person(){}
public Person(double _h,double _w,string _name)
{
h = _h;
w = _w;
名稱= _名稱;
}
}
}
使用系統;
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;
使用System.Threading.Tasks;
命名空間ConsoleApp1
{
類Program
{
類Person
{
Double h,w;
字符串名稱;
public double bmi()
{
返回10000.0 * w /(h * h);
}
public void print()
{
Console.WriteLine(“ h =” + h);
Console.WriteLine(“ w =” + w);
Console.WriteLine(“ name =” + name);
}
public Person(){}
public Person(double _h,double _w,string _name)
{
h = _h;
w = _w;
名稱= _名稱;
}
}
static void Main(string [] args)
{
Console.WriteLine(“習題庫”);
Person [] XX =新的Person [3];
XX [0] =新人物(170,60,“ MapleRD”);
XX [1] =新人(178、90,“火妹”);
XX [2] =新人物(165、70,“胖子”);
foreach(XX中的人X)
{
X.print();
Console.WriteLine(“
Console.WriteLine(“ ============”);
}
Console.ReadKey();
}
}
}
使用系統;
命名空間ConsoleApp2
{
類Person
{
double h,w;
字符串名稱;
public double bmi()
{
返回10000.0 * w /(h * h);
}
public void print()
{
Console.WriteLine(“ h =” + h);
Console.WriteLine(“ w =” + w);
Console.WriteLine(“ name =” + name);
}
public Person(){}
public Person(double _h,double _w,string _name)
{
h = _h;
w = _w;
名稱= _名稱;
}
static void Main(string [] args)
{
Console.WriteLine(“練習用OOP”);
Person [] XX =新的Person [3];
XX [0] =新人物(165,68,“
XX [1] =新人(190、80,“ zoe”);
XX [2] = new Person(180,60,“ john”);
foreach(XX中的人員x)
{
x.print();
Console.WriteLine(“ bmi =” + x.bmi());
Console.WriteLine(“ ===========”);
}
Console.ReadKey();
}
using System;
namespace ConsoleApp1
{
class Program
{
class person
{
double h, w;
String name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public person() { }
public person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
person[] XX = new person[3];
XX[0] = new person(150, 45, "Alice");
XX[1] = new person(178, 90, "John");
XX[2] = new person(175, 60, "Carl");
foreach (person X in XX)
{
X.print();
Console.WriteLine("BMI=" + X.bmi());
Console.WriteLine("==============");
}
Console.ReadKey();
}
}
}
使用系統;
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;
使用System.Threading.Tasks;
命名空間ConsoleApp1
{
類Program
{
類Person
{
Double h,w;
字符串名稱;
public double bmi()
{
返回10000.0 * w /(h * h);
}
public void print()
{
Console.WriteLine(“ h =” + h);
Console.WriteLine(“ w =” + w);
Console.WriteLine(“ name =” + name);
}
public Person(){}
public Person(double _h,double _w,string _name)
{
h = _h;
w = _w;
名稱= _名稱;
}
}
static void Main(string [] args)
{
Console.WriteLine(“習題庫”);
Person [] XX =新的Person [3];
XX [0] =新人物(170,60,“ MapleRD”);
XX [1] =新人(178、90,“火妹”);
XX [2] =新人物(165、70,“胖子”);
foreach(XX中的人X)
{
X.print();
Console.WriteLine(“
Console.WriteLine(“ ============”);
}
Console.ReadKey();
}
}
}
using System;
namespace ConsoleApp2
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() {}
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
static void Main(string[] args)
{
Console.WriteLine("練習用OOP");
Person[] XX = new Person[3];
XX[0] = new Person(165,68,"alice");
XX[1]= new Person(190, 80, "zoe");
XX[2]= new Person(180, 60, "john");
foreach (Person x in XX)
{
x.print();
Console.WriteLine("bmi=" + x.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
using System;
namespace ConsoleApp2
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() {}
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
static void Main(string[] args)
{
Console.WriteLine("練習用OOP");
Person[] XX = new Person[3];
XX[0] = new Person(165,68,"alice");
XX[1]= new Person(190, 80, "zoe");
XX[2]= new Person(180, 60, "john");
foreach (Person x in XX)
{
x.print();
Console.WriteLine("bmi=" + x.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
class Person
{
Double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(170,60,"MapleRD");
XX[1] = new Person(178, 90, "fire sister");
XX[2] = new Person(165, 70, "fatfat");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi02
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("BMI練習");
Person[] XX= new Person[3];
XX[0] = new Person(173, 87, "Big Pack01");
XX[1] = new Person(173, 90, "Big Pack02");
XX[2] = new Person(173, 93, "Big Pack03");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("sex:" + 'm');
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("=================");
}
Console.ReadKey();
}
}
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("name=" + name);
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
}
public void looseWeight(double ww)
{
w -= ww;
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
class Person
{
Double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(170,60,"MapleRD");
XX[1] = new Person(178, 90, "fire sister");
XX[2] = new Person(165, 70, "fatfat");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("============");
}
Console.ReadKey();
}
}
}
使用系統;
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;
使用System.Threading.Tasks;
命名空間ConsoleApp1
{
類Program
{
類Person
{
Double h,w;
字符串名稱;
public double bmi()
{
返回10000.0 * w /(h * h);
}
public void print()
{
Console.WriteLine(“ h =” + h);
Console.WriteLine(“ w =” + w);
Console.WriteLine(“ name =” + name);
}
public Person(){}
public Person(double _h,double _w,string _name)
{
h = _h;
w = _w;
名稱= _名稱;
}
}
static void Main(string [] args)
{
Console.WriteLine(“習題庫”);
Person [] XX =新的Person [3];
XX [0] =新人物(170,60,“ MapleRD”);
XX [1] =新人(178、90,“火妹”);
XX [2] =新人物(165、70,“胖子”);
foreach(XX中的人X)
{
X.print();
Console.WriteLine(“
Console.WriteLine(“ ============”);
}
Console.ReadKey();
}
}
}
使用系統;
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;
使用System.Threading.Tasks;
命名空間ConsoleApp1
{
類Program
{
類Person
{
Double h,w;
字符串名稱;
public double bmi()
{
返回10000.0 * w /(h * h);
}
public void print()
{
Console.WriteLine(“ h =” + h);
Console.WriteLine(“ w =” + w);
Console.WriteLine(“ name =” + name);
}
public Person(){}
public Person(double _h,double _w,string _name)
{
h = _h;
w = _w;
名稱= _名稱;
}
}
static void Main(string [] args)
{
Console.WriteLine(“習題庫”);
Person [] XX =新的Person [3];
XX [0] =新人物(170,60,“ MapleRD”);
XX [1] =新人(178、90,“火妹”);
XX [2] =新人物(165、70,“胖子”);
foreach(XX中的人X)
{
X.print();
Console.WriteLine(“
Console.WriteLine(“ ============”);
}
Console.ReadKey();
}
}
}
使用系統;
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;
使用System.Threading.Tasks;
命名空間ConsoleApp1
{
類Program
{
類Person
{
Double h,w;
字符串名稱;
public double bmi()
{
返回10000.0 * w /(h * h);
}
public void print()
{
Console.WriteLine(“ h =” + h);
Console.WriteLine(“ w =” + w);
Console.WriteLine(“ name =” + name);
}
public Person(){}
public Person(double _h,double _w,string _name)
{
h = _h;
w = _w;
名稱= _名稱;
}
}
static void Main(string [] args)
{
Console.WriteLine(“習題庫”);
Person [] XX =新的Person [3];
XX [0] =新人物(170,60,“ MapleRD”);
XX [1] =新人(178、90,“火妹”);
XX [2] =新人物(165、70,“胖子”);
foreach(XX中的人X)
{
X.print();
Console.WriteLine(“
Console.WriteLine(“ ============”);
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("練習OOP");
Person[] XX = new Person[3];
XX[0] = new Person(165, 68, "Alice");
XX[1] = new Person(178, 90, "John");
XX[2] = new Person(175, 70, "Carl");
foreach(Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("==============");
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bmi
{
class Person
{
double h, w;
string name;
public double bmi()
{
return 10000.0 * w / (h * h);
}
public void print()
{
Console.WriteLine("h=" + h);
Console.WriteLine("w=" + w);
Console.WriteLine("name=" + name);
}
public Person() { }
public Person(double _h, double _w, string _name)
{
h = _h;
w = _w;
name = _name;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("....");
Person[] XX = new Person[3];
XX[0] = new Person(170, 55, "A momomomomo~");
XX[1] = new Person(180, 65, "zzzzzz");
XX[2] = new Person(173, 87, "aaaaaa");
foreach (Person X in XX)
{
X.print();
Console.WriteLine("bmi=" + X.bmi());
Console.WriteLine("===========");
}
Console.ReadKey();
}
}
}
張貼留言