したプログラムを作りたい
ソースコードは
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
using namespace std;
class Friend {
const char *name[30];
int age;
const char *taste[256];
public:
Friend();
Friend(const char *,int a,const char *);
~Friend()
{
}
void show();
};
Friend::Friend() {
name[30] = "0";
age = -1;
taste[256] = "no taste\0";
}
Friend::Friend(const char *n, int a,const char *b) {
name[30] = n;
age = a;
taste[256] = b;
}
void Friend::show() {
cout << "名前は" << name << "年齢は" << age << "趣味は" << taste << endl;
}
int main() {
Friend fr1;
fr1.show();
Friend fr2("yamada\0",20,"pc\0");
fr2.show();
system("pause");
return 0;
}