- 注册
- 2008-03-05
- 消息
- 102
- 荣誉分数
- 31
- 声望点数
- 0
请问下!
part of code:
class Buddy {
public:
char first_ca[8];
char last_ca[12];
int age_n;
public:
Buddy() { cout << "Buddy object being created.\n"; }
~Buddy() { cout << "Buddy object being destroyed.\n"; }
};
int main()
const int MAX = 14;
Buddy MyFriends_aC[MAX];
...
int numFriends_n = 0;
...
for (int i=0; i<numFriends_n; i++) {
cout << "Friend " << (i+1) << ": ";
cout << "Name:" << (*(MyFriends_aC+i)).last_ca <<
", " << (*(MyFriends_aC+i)).first_ca
<< " Age:" << (*(MyFriends_aC+i)).age_n << endl;
}
...
part of code2:
class Buddy {
public:
char first_ca[8];
char last_ca[12];
int age_n;
public:
Buddy() { cout << "Buddy object being created.\n"; }
~Buddy() { cout << "Buddy object being destroyed.\n"; }
};
int main()
{
const int MAX = 14;
Buddy* MyFriends_aPtr[MAX];
...
int numFriends_n = 0;
...
for (int i=0; i<numFriends_n; i++) {
cout << "Buddy " << (i+1) << ": ";
cout << "Name:" << MyFriends_aPtr->last_ca << ", "
<< MyFriends_aPtr->first_ca
<< " Age:" << MyFriends_aPtr->age_n << endl;
}
...
part of code 3:
class Buddy {
public:
char first_ca[8];
char last_ca[12];
int age_n;
public:
Buddy() { cout << "Buddy object being created.\n"; }
~Buddy() { cout << "Buddy object being destroyed.\n"; }
};
int main()
{
int numFriends_n=0;
cout << "Notice: No Buddy objects have yet been created.\n";
cout << "Number of buddies: "; cin >> numFriends_n;
Buddy* MyFriends_aPtr;
MyFriends_aPtr = new Buddy[numFriends_n];
...
for (int i=0; i<numFriends_n; i++) {
cout << "Friend " << (i+1) << ": ";
cout << "Name:" << (*(MyFriends_aPtr+i)).last_ca <<
", " << (*(MyFriends_aPtr+i)).first_ca
<< " Age:" << (*(MyFriends_aPtr+i)).age_n << endl;
}
。。。
这是部分code!
完整的话有点多!!
所以。。
我的问题是!我搞不清红色字体的部分是什么data type》
还有就是pointer算不算一个data type啊???像int, char。。 一样????
thanks。。。thanks。。。thanks。。。thanks。。。thanks。。。
part of code:
class Buddy {
public:
char first_ca[8];
char last_ca[12];
int age_n;
public:
Buddy() { cout << "Buddy object being created.\n"; }
~Buddy() { cout << "Buddy object being destroyed.\n"; }
};
int main()
const int MAX = 14;
Buddy MyFriends_aC[MAX];
...
int numFriends_n = 0;
...
for (int i=0; i<numFriends_n; i++) {
cout << "Friend " << (i+1) << ": ";
cout << "Name:" << (*(MyFriends_aC+i)).last_ca <<
", " << (*(MyFriends_aC+i)).first_ca
<< " Age:" << (*(MyFriends_aC+i)).age_n << endl;
}
...
part of code2:
class Buddy {
public:
char first_ca[8];
char last_ca[12];
int age_n;
public:
Buddy() { cout << "Buddy object being created.\n"; }
~Buddy() { cout << "Buddy object being destroyed.\n"; }
};
int main()
{
const int MAX = 14;
Buddy* MyFriends_aPtr[MAX];
...
int numFriends_n = 0;
...
for (int i=0; i<numFriends_n; i++) {
cout << "Buddy " << (i+1) << ": ";
cout << "Name:" << MyFriends_aPtr->last_ca << ", "
<< MyFriends_aPtr->first_ca
<< " Age:" << MyFriends_aPtr->age_n << endl;
}
...
part of code 3:
class Buddy {
public:
char first_ca[8];
char last_ca[12];
int age_n;
public:
Buddy() { cout << "Buddy object being created.\n"; }
~Buddy() { cout << "Buddy object being destroyed.\n"; }
};
int main()
{
int numFriends_n=0;
cout << "Notice: No Buddy objects have yet been created.\n";
cout << "Number of buddies: "; cin >> numFriends_n;
Buddy* MyFriends_aPtr;
MyFriends_aPtr = new Buddy[numFriends_n];
...
for (int i=0; i<numFriends_n; i++) {
cout << "Friend " << (i+1) << ": ";
cout << "Name:" << (*(MyFriends_aPtr+i)).last_ca <<
", " << (*(MyFriends_aPtr+i)).first_ca
<< " Age:" << (*(MyFriends_aPtr+i)).age_n << endl;
}
。。。
这是部分code!
完整的话有点多!!
所以。。
我的问题是!我搞不清红色字体的部分是什么data type》
还有就是pointer算不算一个data type啊???像int, char。。 一样????
thanks。。。thanks。。。thanks。。。thanks。。。thanks。。。