科目名稱:資訊系統 與網路導論 | 開課系所:資訊工程 學系 | 任課教師 |
吳坤熹 |
||
系所別: |
年級: |
學號: |
姓名: |
考試日期 |
2008.4.10 |
(考試時間: 8:20-8:45)
#include <iostream>
class Complex
{
double Re; // real part
double Im; // imaginary part
};
void main()
{
Complex a;
a.Re = 1.0;
a.Im = 2.0;
std::cout << a.Im << std::endl;
}
#include <iostream>
using std::cout;
class Node
{
public:
int data;
Node* left;
Node* right;
void Print()
{
if (this->left)
this->left->Print();
cout << data;
if (this->right)
this->right->Print();
}
Node(int i)
{
data = i;
left = 0;
right = 0;
}
};
void main()
{
Node one(1);
Node two(2);
Node three(3);
one.left = &two;
one.right = &three;
one.Print();
}