Dynamic.cpp
上传用户:sz0451
上传日期:2022-07-29
资源大小:256k
文件大小:1k
- // This is the main project file for VC++ application project
- // generated using an Application Wizard.
- #include "stdafx.h"
- #using <mscorlib.dll>
- using namespace System;
- // This is the entry point for this application
- #ifdef _UNICODE
- int wmain(void)
- #else
- int main(void)
- #endif
- {
- Console::WriteLine(S"Dynamic Arrays");
- // Create an array dynamically
- int* pa = new int[10];
- // Fill the array
- for(int i=0; i<10; i++)
- pa[i] = i*2;
- // Print the array content
- for(int j=0; j<10; j++)
- Console::WriteLine(pa[j]);
- // Get rid of the array once we're finished with it
- delete pa;
- return 0;
- }