程序运行截图如下:
代码如下:
#include <QApplication> #include <QDebug> int main(int argc, char *argv[]) { QApplication a(argc, argv); #ifdef Q_OS_WIN32 qDebug()<<"这个是Windows操作系统!"; QString myQStr("Windows %1,%2,%3,%4"); #else qDebug()<<"反正不是Windows操作系统!"; QString myQStr("unWindows %1,%2,%3,%4"); #endif myQStr=myQStr.arg("第一个参数",".xml",".qml",".cpp"); qDebug()<<myQStr; return a.exec(); }
貌似大佬写的代码都喜欢对各种情况进行判断,想得比较多!!!!