摘要:
1 #include 2 using namespace std; 3 4 class man 5 { 6 private: 7 int id; 8 char ch; 9 10 public: 11 //0个参数委托一个参数的构造函数,一个参数的委托两个参数的构造函数构造 12 man():man(1) 13 { 14 15 ... 阅读全文
摘要:
1 #include 2 #include //类型索引 3 #include //红黑树 4 #include 5 using namespace std; 6 7 class myclass 8 { 9 10 }; 11 12 void main() 13 { 14 //索引与string进行映射 15 unordered_map mytype;/... 阅读全文
摘要:
1 #include 2 #include 3 #include 4 using namespace std; 5 6 //初始化数据的时候,如果类中引用其他类,需要重写构造函数,int也是类 7 class myclass 8 { 9 public: 10 int x; 11 int y; 12 13 public: 14 myclass(i... 阅读全文
摘要:
按钮点击获取文本框输入 1 void Dialog::on_pushButton_clicked() 2 { 3 //获取文本输入 4 QString vstr = ui->lineEdit->text(); 5 6 //判断是否转换成功 7 bool isok; 8 //转换 9 int valu 阅读全文
摘要:
一维数组封装 myArray.h myArray.cpp 1 #include "myArray.h" 2 3 myArray::myArray(initializer_list<int> list) 4 { 5 this->n = list.size();//开辟内存 6 this->p = ne 阅读全文
摘要:
1 #include "mainwindow.h" 2 #include 3 #include 4 5 //定义一个窗口类 6 class Window 7 { 8 public: 9 MainWindow *p; 10 int x;//大小 11 int y; 12 int cx;//位置 13 int cy; 14 15 pu... 阅读全文
摘要:
1 //指针数组,每一个指针都是一个MainWindow 2 // MainWindow *w[3][4]; 3 // for(int i=0;imove(i*100,j*100); 9 // w[i][j]->resize(100,100); 10 // w[i][j]->show(); 11 // } 12 //... 阅读全文
摘要:
1 #include 2 #include 3 using namespace std; 4 using namespace std::placeholders; 5 6 template 7 void show(T t) 8 { 9 cout 16 void show(T t) 17 { 18 cout ; 30 p(... 阅读全文
摘要:
1 #include 2 #include 3 using namespace std; 4 5 void main() 6 { 7 //&调用外部 8 //function fun = [&]()->void {cout fun = [&](int i) 10 { 11 if (i == 0) 12 { 13 ... 阅读全文
摘要:
1 #include 2 #include 3 using namespace std; 4 5 void main() 6 { 7 auto fun = [](char *str)->int 8 { 9 int res = 0; 10 char *p = str; 11 int length = strl... 阅读全文
摘要:
1 #include 2 using namespace std; 3 4 class myclass 5 { 6 public: 7 int num; 8 int num2; 9 10 public: 11 myclass(int num) 12 { 13 this->num = 0; 14 this->n... 阅读全文