アニメ!アニメ!

2015年6月17日水曜日

C++ 構造体

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;


//int main()
//{
// return 0;
//}

struct Hunter
{
int rank;
int Damage;
int  Health;
int  Attack;
int  Defense;
int  Magic;
int Speed;
int Luck;
int Experiencel;
int Level;
};

 
//int main()
//{
//Hunter.rank = 10;

//Hunter 1;
//a.rank = 10;

//return 0;
//}

int main()
{

//Student.japanese = 60;

Student a;
strcpy(a.name, "リリアル");

};

struct Student
{
char name[32];
int japanese;
int math;
int english;
};

struct Profile
{
char name[32];
int age;


};

struct Enemy
{

};

struct Action
{


};


struct World
{



};

//移動タイプ
enum class MoveType
{
None,
Walk,
Fly,
Warp,
};

enum class Tribe
{
Dwarf,
Walk,
Human,
};

//ユニット型
struct Unit
{
char name[32];
Tribe tribe;
MoveType monveType;
Tribe Tribe;
};

struct _person{
char name[20];
char sex;
int age;
double height;
double weight;
};

typedef struct{
char name[20];
char sex;
int age;
double height;
double weight;
} person_t;

person_t p;


int main()
{
//一人目のユニット
Unit a;
strcpy(a.name, "ドワーフ");
a.tribe = Tribe::Dwarf;
a.monveType = MoveType::Walk;

//二人目のユニット
Unit b;
strcpy(a.name, "ドワーフ");
a.tribe = Tribe::Dwarf;
a.monveType = MoveType::Walk;
//百人分のユニット
Unit c[100];
for (int i = 0; i < 100; i++)
{
strcpy(c[i].name, "名無し");
c[i].tribe = Tribe::Human;
c[i].monveType = MoveType::Walk;
}

return 0;
}