Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Information Science and Engineering
不要交原程序!!!
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 18, Accepted users: 17
Problem 11615 : No special judgement
Problem description
  阅读下面的程序,现给多组测试数据,你的任务是将程序运行的结果输出来。
注意:此题直接提交原程序可能超时
#include<iostream>
using namespace std;
class Base
{
public:
virtual void opt() { cout << "Apple" << endl; }
};
class cs1 : public Base
{
public:
void opt() { cout << "Banana" << endl;  }
};
class cs2 : public Base
{
public:
//void opt() { cout << "Car" << endl; }   注意此行已被注释
};
int main()
{
int t;
Base A;
cs1 B;
cs2 C;
while ( cin >> t && t )
{
if(t == 1)
{
Base *p;
p = &A;
p -> opt();
}
else if (t == 2)
{
cs1 *p;
p = &B;
p -> opt();
}
else
{
cs2 *p;
p = &C;
p -> opt();
}
}
return 0;
}

Input
  测试数据有多组,对于每组测试数据,输入t (t=0,1,2,3)。

Output
  输出该程序运行的结果即可

Sample Input
1
2
0
Sample Output
Apple
Banana
Submit   Clarifications   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:19295 today,16242286 total, since 2010-05-07