23,125
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;
#define PI 3.1415926
const int WEEK= 7;
const string NAME= "weijl";
static double SCORE= 99.0;
class CMyData
{
public:
CMyData()
{
a = 0;
str = string("weijl");
c = 65;
}
~CMyData()
{
}
int a;
string str;
float c;
int GetA()
{
return a;
}
string GetStr()
{
return str;
}
float GetC()
{
return c;
}
void setmv()
{
m_v.push_back("weijl");
m_v.push_back("shenzhen");
m_v.push_back("nanning");
m_v.push_back("C++ Program");
}
public:
typedef vector<string> vs;
typedef vector<string>::iterator It;
vs m_v;
};
int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
CMyData data;
cout << data.a << endl << data.str << endl << data.c << endl;
data.setmv();
CMyData::vs v = data.m_v;
CMyData::It it = v.begin();
while( it != v.end())
{
string s = *it;
cout << s << endl;
it++;
}
int i1 = 32;
int i2 = 45;
double d = i1 + i2 / 3;
vector<string> vstr;
vstr.push_back("Hello");
vstr.push_back("World");
vstr.push_back("!");
map<string, int> m_si;
m_si["A"] = 12;
m_si["D"] = 93;
m_si["B"] = 77;
return 0;
}