Skip to content

Instantly share code, notes, and snippets.

@tanakh
Forked from chomado/p239.cpp
Last active August 29, 2015 14:05
Show Gist options
  • Save tanakh/3ddcdd650585169b8860 to your computer and use it in GitHub Desktop.
Save tanakh/3ddcdd650585169b8860 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
using namespace std;
class Person {
string name;
int age;
char sex;
public:
Person(const string &nm, int n, char s) : name(nm), age(n), sex(s) {}
void show();
};
void Person::show() {
cout << "氏名: " << name << endl;
cout << "年齢: " << age << " 歳" << endl;
cout << "性別: " << sex << endl;
}
int main()
{
Person yamada("ヤマダ", 26, 'M');
Person tanaka("田中", 24, 'F');
yamada.show();
tanaka.show();
return 0;
}
#include <iostream>
#include <string>
using namespace std;
class Person {
string name;
int age;
char sex;
public:
Person(const string &nm, int n, char s) : name(nm), age(n), sex(s) {}
void show();
};
void Person::show() {
cout << "氏名: " << name << endl;
cout << "年齢: " << age << " 歳" << endl;
cout << "性別: " << sex << endl;
}
int main()
{
Person tanaka("田中", 24, 'F');
Person yamada("ヤマダ", 26, 'M');
yamada.show();
tanaka.show();
return 0;
}
#include <iostream>
#include <string>
using namespace std;
class Person {
string name;
int age;
char sex;
public:
Person(const string &nm, int n, char s) : name(nm), age(n), sex(s) {}
void show();
};
void Person::show() {
cout << "氏名: " << name << endl;
cout << "年齢: " << age << " 歳" << endl;
cout << "性別: " << sex << endl;
}
int main()
{
Person chomado("ちょまど",24, 'F');
Person yamada("ヤマダ", 26, 'M');
Person tanaka("田中", 24, 'F');
yamada.show();
tanaka.show();
Person chomado2("ちょまど",24, 'F');
Person yamada2("ヤマダ", 26, 'M');
Person tanaka2("田中", 24, 'F');
Person chomado3;
Person yamada3;
Person tanaka3;
int a;
int b, c;
int d;
string t;
string u,v;
string w,
string ss("hoge");
string tt("moge");
string uu("hage");
string vv;
string ww("hoge");
string xx("hoge");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment