....
// 打印坐标的函数
void printInfo()
{
cout << "(" << m_iX << "," << m_iY << ")\n";
}
public:
int m_iX;
int m_iY;
};
int main(void)
{
//定义对象数组
Coordinate coorArr[2];
coorArr[0].m_iX = 1;
coorArr[0].m_iY = 2;
coorArr[1].m_iX = 3;
coorArr[1].m_iY = 4;
// 打印坐标的函数
void printInfo()
{
cout << "(" << m_iX << "," << m_iY << ")\n";
}
public:
int m_iX;
int m_iY;
};
int main(void)
{
//定义对象数组
Coordinate coorArr[2];
coorArr[0].m_iX = 1;
coorArr[0].m_iY = 2;
coorArr[1].m_iX = 3;
coorArr[1].m_iY = 4;
Coordinate *p = new Coordinate[3];
p->m_iX = 7;
p->m_iY = 9;
// p = p+1; // p = p + 1;
(p+1)->m_iX = 11;
(p+1)->m_iY = 17;
// p = p+1;
(p+2)->m_iX = 3;
(p+2)->m_iY = 2;
p->m_iX = 7;
p->m_iY = 9;
// p = p+1; // p = p + 1;
(p+1)->m_iX = 11;
(p+1)->m_iY = 17;
// p = p+1;
(p+2)->m_iX = 3;
(p+2)->m_iY = 2;
2016-12-21
这样都可以...
#include <iostream>
int main()
{
std::cout << "(1,2)" << std::endl << "(3,4)" << std::endl;
}
#include <iostream>
int main()
{
std::cout << "(1,2)" << std::endl << "(3,4)" << std::endl;
}