07 2021 档案
摘要:#ifndef GLOBAL_H_CSX #define GLOBAL_H_CSX #include <string> #include <QString> using namespace std; extern QString g_layout; inline QString s2q(const
阅读全文
摘要://mainwindow.cpp文件,主界面实现 #include "mainwindow.h" #include "ui_mainwindow.h" #include <qdebug.h> #include <qprocess.h> MainWindowMainWindow(QWidget *pa
阅读全文
摘要:Qt 官方开发环境使用的动态链接库方式,在发布生成的exe程序时,需要复制一大堆 dll,如果自己去复制dll,很可能丢三落四,导致exe在别的电脑里无法正常运行。因此 Qt 官方开发环境里自带了一个工具:windeployqt.exe。 集成开发环境 QtCreator 目前生成图形界面程序 ex
阅读全文
摘要:#include<cstring> #include<cstdio> #include<iostream> #include <atlstr.h> using namespace std; int main() { FILE *fp_statfile = fopen("123.txt", "a+")
阅读全文
摘要:#include<iostream> using namespace std; int main() { //声明指针数组 const char *colors[] = { "red","blue","yellow","green" }; //指向指针的指针变量 const char **pt; /
阅读全文
摘要:C、C++中没有提供直接获取数组长度的函数,对于存放字符串的字符数组提供了一个strlen函数获取长度,那么对于其他类型的数组如何获取他们的长度呢?其中一种方法是使用sizeof(array) / sizeof(array[0]), 在C语言中习惯上在使用时都把它定义成一个宏,比如#define G
阅读全文
摘要:#include <iostream> using namespace std; template int getArrayLen(T& array) //使用模板定义一个函数getArrayLen,该函数将返回数组array的长度 { return (sizeof(array) / sizeof(
阅读全文
摘要:#include <iostream> using namespace std; int main() { //声明字符型数组和指针变量 char str[10]; char *strip = str; //输入输出 cout << "str = "; cin >> str;//用字符数组输入字符串
阅读全文
摘要:#include <iostream> using namespace std; int main() { //声明数组、变量和指针变量 int a[] = { 1,2,3,4,5,6 }; int *ip1, *ip2; //测试指针的赋值运算 ip1 = a; ip2 = ip1; cout <
阅读全文
摘要:#include <iostream> using namespace std; int main() { //声明数组、变量和指针变量 int a[2][3], i, j; int *ip; //从键盘上为数组a赋值 for ( i = 0; i < 2; i++) { for ( j = 0;
阅读全文
摘要:#include <iostream> using namespace std; int main() { //声明变量和指针变量 int a, b, c, *p; //指针变量ip指向变量a a = 100; p = &a; //使指针变量 ip 指向变量a cout << "a = " << a
阅读全文
摘要:#include <iostream> using namespace std; int main() { //声明字符数组和变量 char str[6]; int i; //从键盘上输入字符串 cout << "str="; cin >> str; cout << endl; //按数组和下标变量
阅读全文
摘要:#include <iostream> #define size 5 using namespace std; int main() { //声明二维数组及变量 int a[2][3]; int i, j; //从键盘上为数组a赋值 for ( i = 0; i < 2; i++) { for (
阅读全文
摘要:// Project25.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include <iostream> #define size 5 using namespace std; int main() { int i, j; float t, a[size];
阅读全文
摘要:// Project25.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include <iostream> #define size 5 using namespace std; int main() { int i, j; float t, a[size];
阅读全文
摘要:#include<iostream> using namespace std; int main() { //声明数组和变量 int a[5], i, sum; double avg; //从键盘上循环为数组赋值 for (i = 0; i < 5; i++) { cout << "a[" << i
阅读全文
摘要:#include <iostream> using namespace std; int main() { int i; for (i = 1; i ⇐ 20; i++) { if (i % 3 == 0)//能被 3 整除的整数,返回进行下次循环 continue; cout << i << en
阅读全文
摘要:#include <iostream> using namespace std; int main() { //累加键盘输入的数据 double x, sum = 0.0; while (1) { cout << "x="; cin >> x; if (x <= 0) break; sum += x
阅读全文
摘要:#include using namespace std; int main() { int x, sum = 0; //定义标号L1 L1: cout << "x="; cin >> x; if (x == -1) goto L2;//无条件转移语句,转到L2语句处 else sum += x;
阅读全文
摘要:#include <iostream> using namespace std; int main() { for (int i = 1; i ⇐ 9; i++) { //cout << i; for (int j = 1; j ⇐ 9; j++) cout << '\t' << i << "*"
阅读全文
摘要:#include <iostream> using namespace std; int main() { //计算s=1+2+3...+100 int s = 0; int n = 0; do { n++; s += n; } while (n <= 100); cout << "s = " <<
阅读全文
摘要:#include <iostream> using namespace std; int main() { //计算s=1+2+3...+100 int s = 0, n = 1; while (n ⇐ 100) { s += n; n++; } cout << "s=" << s << endl;
阅读全文
摘要:#include <iostream> using namespace std; int main() { //显示1,2,3...10 for (int i = 1; i ⇐ 10; i++) cout << i << endl; //显示10,9,8...1 for (int i = 10; i
阅读全文
摘要:#include <iostream> using namespace std; float x = 365.5; //声明全局变量; int main() { int x = 1, y = 2; double w = x + y; { double x = 1.121, y = 1.362, z
阅读全文
摘要:#include <iostream> using namespace std; int main() { //x,y 为操作数,c为运算符 int x, y, z; char c1; cin >> x >> c1 >> y; //多路选择语句选择不同表达式计算语句 switch (c1) { ca
阅读全文
摘要:#include <iostream> using namespace std; int main() { int a, b, MAX; cout << "a = " ; cin >> a ; cout << "b = " ; cin >> b; MAX = a > b ? a : b; cout
阅读全文
摘要:#include <iostream> using namespace std; int Ssmallest(int q, int w, int e); int a, b, c; int d, e, f; int smallest; int main() { Ssmallest(d, e, f);
阅读全文
摘要:#include<iostream> using namespace std; int main(){ float a, b, s; cout << "a b" << endl; cin >> a >> b; s = a; if (a < b) { s = b; //if语句中只有这一个语句,可省略
阅读全文
摘要:#include<iostream> using namespace std; int main() { //测试表达式类型的转换 int n = 100, m; double x = 3.4157, y; cout << "n*x = " << n * x << endl; //赋值类型转换 m
阅读全文
摘要:#include <iostream> using namespace std; int main() { //用 sizeof 计算各类种常量的字节长度 cout << "sizeof('\(') = " << sizeof('\)') << endl; cout << "sizeof(1) =
阅读全文
摘要:#include <iostream> using namespace std; int main() { //按位与 cout << "32&12=" << (32 & 12) << endl; //按位异或 cout << "43^23 = " << (43 ^ 23) << endl; //按
阅读全文
摘要:// Project23.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include <iostream> using namespace std; int main() { char name1[50]; char name2[50]; /cin >> nam
阅读全文