![]() |
#2
xxlovemf2010-07-30 10:42
|
#include<iostream>
#include<stdlib.h>
#include<string>
using namespace std;
struct Monster
{
char* name; //为什么这行改为 string name;程序就通不过呢。如果非得用string name;后面的应该怎么改呢
int power;
int agile;
}mon;
void monster()
{
Monster mon[3]={"野猴",45,50,"山猪",43,43,"老虎",32,49};
int i;
for(i=0;i<3;i++)
{
cout<<mon[i].name<<mon[i].power<<mon[i].agile<<endl;
}
}
int main()
{
monster();
system("PAUSE");
return 0;
}