随笔分类 - c++
摘要:项目开发时候要看着表结构写,实在是受不了phpmyadmin或者是navicat,就用qt写了一个看表结构的小玩意,主要是看表字段的注释。使用过程中发现过一段时间,连接就会被mysqld自动断开,就在每次查询前多执行一个“select 1;”,反正是开发时候用,浪费资源就浪费吧。 1 #include <QApplication> 2 #include "mainwindow.h" 3 4 int main(int argc, char *argv[]) 5 { 6 QApplication a(argc, argv); 7 MainWindow w; 8 w.
阅读全文
摘要:/cpp/dll/fun.cpp#include "fun.h"int fun(int n){ if (n < 1) return 1; return n * fun(n - 1);}/cpp/dll/fun.h#ifndef FUN_H#define FUN_Hint fun(int n);#endif // FUN_H/cpp/dll/main.cpp#include <iostream>using namespace std;#include "fun.h"int main(){ cout << fun(5) <
阅读全文
摘要:python的修改版字幕合并随着装系统而丢了,就用qt又写一遍。。SubtitlesMerger.pro 1 #------------------------------------------------- 2 # 3 # Project created by QtCreator 2012-04-14T15:32:10 4 # 5 #------------------------------------------------- 6 7 QT += core gui 8 9 TARGET = SubtitlesMerger10 TEMPLATE = app11 12 TR...
阅读全文
摘要:1 #include <iostream> 2 3 template <class T> 4 class List 5 { 6 struct Item 7 { 8 T data; 9 Item *next; 10 }; 11 12 public: 13 List(); 14 ~List(); 15 16 bool isEmpty() const; 17 int length() const; 18 const T &at(int k) const; 19 int s...
阅读全文
摘要:/qt/musicplayer/main.cpp#include<QtGui/QApplication>#include"widget.h"intmain(intargc,char*argv[]){QApplicationa(argc,argv);a.setApplicationName("musicplayer");Widgetw;w.show();returna.exec();}/qt/musicplayer/widget.h#ifndefWIDGET_H#defineWIDGET_H#include<QWidget>#inc
阅读全文
摘要:/cgi-bin/getfile.cpp#include<iostream>#include<fstream>#include<string>#include<cstdlib>usingnamespacestd;voidhtmlspecialchars(conststring&s,string&ret){ret="";for(string::const_iteratori=s.begin();i!=s.end();i++){switch(*i){case'<':ret+="&am
阅读全文
摘要:m.cpp#include <iostream>#include <fstream>#include <string>#include <sstream>using namespace std;int main(){ ifstream in("in.txt"); string s; getline(in, s); // read for length int length; { istringstream sin(s); sin >> length; } // dim array double** arr = n.
阅读全文
摘要:a.cpp#include <iostream>#include <vector>#include <fstream>using namespace std;int ne, nj, njt;vector<int*> jh; // 2vector<int*> jtx; // 4vector<int*> jw; // 3vector<int*> mw; // 6void qjw(){ int counter = 1; for (int i = 0; i < nj; ++i) { int *toAdd = ne
阅读全文
浙公网安备 33010602011771号