qq_34418970 于 2016.05.10 22:40 提问

public class GoodList : CollectionBase
{
public virtual int Add(T fruit)
{
return InnerList.Add(fruit);
}
public new void RemoveAt(int index)
{
InnerList.RemoveAt(index);
}
public T GetItem(int index)
{
return (T)List[index];
}
public void Set(int index, T fruit)
{
this.RemoveAt(index);
this.Add(fruit);
}
}
public class Program
{
static void Main(string[] args)
{

``````    Fruti f1 = new Fruti("n1001","苹果","1.5",6);
Fruti f2 = new Fruti("n1002", "香蕉", "0.4", 4);
Fruti f3 = new Fruti("n1003", "橘子", "0.5", 10);
Drink d1 = new Drink("n2001","绿茶","3",2);
Drink d2 = new Drink("n2002", "红茶", "2.5", 4);
GoodList gd=new GoodList();
``````

1个回答

silehaixianghuirenj   2016.10.08 01:26

public class GoodList : CollectionBase
{
public virtual int Add(T fruit)
{
return InnerList.Add(fruit);
}
public new void RemoveAt(int index)
{
InnerList.RemoveAt(index);
}
public T GetItem(int index)
{
return (T)List[index];
}
public void Set(int index, T fruit)
{
this.RemoveAt(index);

T1095 数1的个数（#Ⅰ- 4 - 2）
【题目描述】给定一个十进制正整数n(1≤n≤10000)，写下从1到n的所有整数，然后数一下其中出现的数字“1”的个数。例如当n=2时，写下1,2。这样只出现了1个“1”；当n=12时，写下1，2，3，4，5，6，7，8，9，10，11，12。这样出现了5个“1”。【输入】   正整数n。1 ≤ n ≤ 10000。【输出】   一个正整数，即“1”的个数。【输入样例】12【输出样例】5【源程序】...
40:数1的个数

#include using namespace std; int Sum1s(int n) { int count = 0; //记录1的个数 int factor = 1; //标记，逐位计算1的个数 int LowerNum = 0; int CurrNum = 0; int HigherNum = 0; while ( n/factor != 0) //每次

POJ NOI0105-40 数1的个数

#include #include struct SpliteNum{  int high;  int cut;  int low; }; using namespace std; int f(long num){  int counter = 0;  for(int i=1;i   int temp = i;   while(temp){    counter +=

GD库生成的图像在浏览器上显示乱码