Point.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>
- #include <tchar.h>
- using namespace System;
- // The Point structure definition
- __value struct Point
- {
- public:
- Point() { x=-1; y=-1; }
- Point(int xVal, int yVal) { x=xVal; y=yVal; }
- int x,y;
- };
- // This is the entry point for this application
- int _tmain(void)
- {
- int n = 0;
- System::Int32 n1 = 0;
- Console::WriteLine(S"A Simple Structure");
- Point p1; // Use the default constructor
- //p1.x = 10;
- //p1.y = 20;
- Console::Write(S"p1.x is ");
- Console::WriteLine(p1.x);
- Point p2(10,10);
- Console::Write(S"p2.x is ");
- Console::WriteLine(p2.x);
- return 0;
- }