prg7_2.cpp

来自「经典数据结构书籍 数据结构C++语言描述 的源代码 很难找的哦」· C++ 代码 · 共 33 行

CPP
33
字号
#include <iostream.h>
#pragma hdrstop

#include "store.h"
#include "student.h"

void main(void)
{
    Student graduate = {1000, 23};
    Store<int> A, B;
    Store<Student> S;
    Store<double> D;

    A.PutElement(3);
    B.PutElement(-7);
    cout << A.GetElement() << "  " << B.GetElement() << endl;

    S.PutElement(graduate);
    cout << "The student id is " << S.GetElement().studID
    	 << endl;

    // D is not initialized
    cout << "Retrieving object D  " << D.GetElement() << endl;
}

/*
<Run of Program 7.2>

3  -7
The student id is 1000
Retrieving object D  No item present!
*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?