09 2021 档案
摘要:DWORD 进程_名取ID(CString 进程名) { HANDLE 进程快照 = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (INVALID_HANDLE_VALUE == 进程快照) { return NULL; } PROCESS
        阅读全文
                
摘要:#include <iostream> using namespace std; //函数重载的注意事项 //1.引用作为函数重载 void fun(int& a) //int &a=10;不合法 { cout << "fun(int& a)调用" << endl; } void fun(const
        阅读全文
                
摘要:#include <iostream> using namespace std; //函数重载 //可以让函数名相同,提高复用性 //函数重载的满足条件 //1.同一个作用域下 //2.函数名称相同 //3.函数参数类型不同,或者个数不同,或者顺序不同 void func() { cout << "
        阅读全文
                
摘要:#include <iostream> using namespace std; //占位参数 //返回值类型 函数名(数据类型){} //目前阶段的占位参数我们还用不到,后面课程中会用到 //占位参数还可以有默认参数 void func(int a, int = 10) { cout << "he
        阅读全文
                
摘要:#include <iostream> using namespace std; //函数的默认参数 //如果我们传入了自己的数据,就用自己的数据,如果没有,那么就用默认 //语法 :返回值类型 函数名(形参=默认值){} int func(int a, int b=20, int c=30) { 
        阅读全文
                
摘要:#include <iostream> using namespace std; //打印数据函数 void showvalue(const int& val) { cout << "val=" << val << endl; } int main() { //常量引用 //使用场景,用来修饰形参,
        阅读全文
                
摘要:#include <iostream> using namespace std; //发现是引用,转换为int * const ref=&a; void func(int& ref) { ref = 100;//ref是引用,转换为*ref=100; } int main() { int a = 1
        阅读全文
                
摘要:#include <iostream> #include <fstream>//包含头文件 using namespace std; void test01() { //1.包含头文件 //2.创建流对象 ofstream ofs; //3.打开文件 ofs.open("text.txt", ios
        阅读全文
                
摘要:#include <iostream> #include <fstream>//包含头文件 #include <string> using namespace std; //文本文件,读文件 void test01() { //1.包含头文件 //2.创建流对象 ifstream ifs; //3.
        阅读全文
                
摘要:#include <iostream> #include <fstream>//包含头文件 using namespace std; //二进制文件 写文件 class Person { public: char m_name[64];//姓名 int m_age;//年龄 }; void test
        阅读全文
                
摘要:#include <iostream> #include <fstream>//包含头文件 #include <string> using namespace std; //二进制文件 读文件 class Person { public: char m_name[64];//姓名 int m_age
        阅读全文
                
摘要:#include <iostream> using namespace std; //引用做函数的返回值 //1.不要返回局部变量的引用 int& test01() { int a = 10; //局部变量存在四区中的栈区 return a; } //2.函数的调用可以作为左值 int& test0
        阅读全文
                
摘要:#include <iostream> using namespace std; //交换函数 //1.值传递 void swap01(int a, int b) { int temp = a; a = b; b = temp; cout << "swap01 a=" << a << endl; c
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { int a = 10; //1.引用必须初始化 //int& b;//错误,必须初始化 int& b = a; //2.引用初始化后,不可以更改 int c = 20; b = c;//赋值操
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //引用基本语法 //数据类型 &别名=原名 int a = 10; //创建引用 int& b = a; cout << "a=" << a << endl; cout << "b=" <<
        阅读全文
                
摘要:#include <iostream> using namespace std; //1.new的基本语法 int* func() { //在堆区创建整数数据 //new返回是 该数据类型的指针 int* p = new int(10); return p; } void test01() { in
        阅读全文
                
摘要:#include <iostream> using namespace std; int* func() { //利用new关键字 可以将数据开辟到堆区 //指针本质也是局部变量,放在栈上,指针保存的数据是放在了堆区 int* p = new int(10); return p; } int mai
        阅读全文
                
摘要:#include <iostream> using namespace std; //栈区数据注意事项--不要返回局部变量的地址 //栈区的数据有编译器管理开辟和释放 int* func(int b)//形参数据也会放在栈区 { b = 100; int a = 10;//局部变量存放在栈区,栈区的
        阅读全文
                
摘要://内存分区模型 //C++程序在执行时, 将内存大方向划分为4个区域 //代码区:存放函数体的二进制代码, 由操作系统进行管理的 //全局区:存放全局变是和静态变是以及常量 //栈区:由编译器自动分配释放, 存放函数的参数值局部变量等 //堆区:由程序员分和释放若员不释放稈序结束时由操作系统回收 
        阅读全文
                
摘要://通讯录是一个可以记录亲人、好友信息的工具 //本教程主要利用C++来实现一个通讯录管理系统 //系统中需要实现的功能如下 //添加联系人向通讯录中添加新人, 信息包括(姓名、性别年龄、联系电话、家庭住址)最多记录1000人 //显示联系人 : 同示通讯录中所有联系人信息 //删除联系人 : 按照
        阅读全文
                
摘要:#include <iostream> using namespace std; struct Hero { //姓名 string name; //年龄 int age; //性别 string sex; }; //冒泡排序实习年龄升序排列 void bubblesort(Hero heroarr
        阅读全文
                
摘要:#include <iostream> using namespace std; //学生结构体 struct Student { //姓名 string sName; //分数 int score; }; //老师的结构体 struct Teacher { //姓名 string tname; /
        阅读全文
                
摘要:#include <iostream> using namespace std; //const 的使用场景 //定义学生结构体 struct student { //姓名 string name; //年龄 int age; //分数 int score; }; //将函数中的形参改为指针,可以减
        阅读全文
                
摘要:#include <iostream> using namespace std; //定义学生结构体 struct student { //姓名 string name; //年龄 int age; //分数 int score; }; //打印学生函数 //1.值传递 void printstud
        阅读全文
                
摘要:#include <iostream> using namespace std; //定义学生结构体 struct student { string name; int age; int score; }; //定义老师结构体 struct teacher { int id; string name
        阅读全文
                
摘要:#include <iostream> using namespace std; //结构体指针 //定义学生结构体 struct Student { //姓名 string name; //年龄 int age; //分数 int score; }; int main() { //1.创建学生结构
        阅读全文
                
摘要:#include <iostream> using namespace std; //1.定义结构体 struct Student { //姓名 string name; //年龄 int age; //分数 int score; }; int main() { //2.创建结构体数组 Studen
        阅读全文
                
摘要:#include <iostream> using namespace std; //1.创建学生数据类型:学生包括(姓名,年龄,分数) //自定义数据类型,一些类型集合组成的一个类型 //语法 struct 类型名称{成员列表} struct Student { //成员列表 //姓名 strin
        阅读全文
                
摘要:#include <iostream> using namespace std; //冒泡排序函数 void bubblesort(int* arr, int len) { for (size_t i = 0; i < len - 1; i++) { //内层循环对比 次数=元素个数-当前轮数-1 
        阅读全文
                
摘要:#include <iostream> using namespace std; void swap01(int a, int b) { int temp = a; a = b; b = temp; cout << "swap01中a=" << a << endl; cout << "swap01中
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() {//指针和数组 //利用指针访问数组中的元素 int arr[10] = { 1,2,3,4,5,6,7,8,9,10 }; cout << "第一个元素为:" << arr[0] << end
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //1.const修饰指针-常量指针 int a = 10; int b = 10; const int* p = &a; //指针指向的值不可以改,指针指向可以改 //*p=20;错误 p 
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //野指针 //在程序中避免出现野指针 int* p = (int*)0x1100; cout << *p << endl;//报错 system("pause"); return 0; }
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //空指针 //1.空指针用于给指针变量进行初始化 int* p = NULL; //2.空指针不可以进行访问 //0`255之间的内存编号是系统占用,不允许访问 //*p = 1000;//
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //指针所占用的内存空间大小 int a = 10; int* p = &a; //32位操作系统,指针占用4个字节空间大小,不管什么数据类型 //64位操作系统,指针占用8个字节空间大小; 
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //1.定义指针 int a = 10; //指针定义的语法:数据类型*指针变量名; int* p; //让指针记录变量a的地址 p = &a; cout << "a的地址为:\t" << &
        阅读全文
                
摘要:1.创建后缀名为.h的头文件,在头文件中写函数声明 //头文件 swap.h #include<iostream> using namespace std; //函数的声明 void swap(int a, int b); 2.创建后缀名为.cpp的源文件,在源文件中写函数定义 //源文件 swap
        阅读全文
                
摘要:#include <iostream> using namespace std; //提前告诉编译器函数的存在,可利用函数的声明 //函数的声明 //声明可以写多次,定义只能一次 int max(int a, int b); int main() { cout << max(100, 600) <<
        阅读全文
                
摘要:#include <iostream> using namespace std; //函数常见样式 //1.无参无返 void test01() { cout << "test01" << endl; } //2.有参无返 void test02(int a) { cout << "test02" 
        阅读全文
                
摘要:#include <iostream> using namespace std; //值传递 //定义函数,实现两个数字进行交换函数 //如果函数不需要返回值,声明的时候可以写void; void swap(int num1, int num2) { cout << "交换前:" << endl; 
        阅读全文
                
摘要:#include <iostream> using namespace std; //定义加法函数 //没有数据,叫形参 int add(int num1, int num2) { return num1 + num2; } int main() { //main函数中调用add函数 int a =
        阅读全文
                
摘要:#include <iostream> using namespace std; //函数定义 //语法 //返回值类型 函数名 (参数列表) //{ //函数语句 //return表达式 //} int add(int num1, int num2) { int sum = num1 + num2
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //二维数组案例-考试成绩统计 //1.创建二维数组 int scores[3][3] = { {100,100,100}, {90,50,100}, {60,70,80} }; string
        阅读全文
                
摘要:#include <iostream> #include<string> using namespace std; int main() { //二维数组名称用法 int arr[2][3] = { {1,2,3,}, {4,5,6} }; cout << "二维数组占用内存空间为:" << siz
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //二维数组定义 /* 1.数据类型 数组名[行数][列数]; 2.数据类型 数组名[行数][列数]={{数据1,数据2},{数据2=3,数据4}}; 3.数据类型 数组名[行数][列数]={
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { int arr[] = { 4,2,8,0,5,7,1,3,9 ,15,17,14 }; cout << "排序前" << endl; for (size_t i = 0; i < (size
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //实现数组元素逆置 //1.创建数组 int arr[] = { 1,2,3,4,5,6 }; cout << "逆置前数组" << endl; for (size_t i = 0; i <
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //创建5只小猪体重 int arr[] = { 300,350,200,400,250,100,50 }; int max = 0;//设置一个最大值 //从数组中找到最大的 for (si
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //数组名用途 //1.可以通过数组名统计整个数组占用的内存大小 int arr[] = { 1,2,3,4,5,6,7,8,9,10 }; cout << "整个数组占用的内存空间为;" <
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //数组 //1.数据类型 数组名[数组长度]; //2.数据类型 数组名[数组长度]={值1.值2...}; //3.数据类型 数组名[]= {值1.值2...}; //1.数据类型 数组名
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //goto语句 cout << "1.xxxxxxxxxx" << endl; cout << "2.xxxxxxxxxx" << endl; goto AA;//跳转到标记 cout <<
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { for (size_t i = 0; i < 100; i++) { //如果是奇数输出,偶数不输出 if (i % 2 == 0) { continue;//到此为止不在执行,执行下次循环 
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //break使用 //1.switch语句中; cout << "选择副本难度" << endl; cout << "1.普通" << endl; cout << "2.中等" << end
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //乘法口诀表 //1×1 = 1 //1×2 = 2 2×2 = 4 //1×3 = 3 2×3 = 6 3×3 = 9 //1×4 = 4 2×4 = 8 3×4 = 12 4×4 = 1
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //利用嵌套循环打印星图 //外层循环,外执行一次,内执行一轮 for (int i = 0; i < 10; i++) { //内层循环 for (int j = 0; j < 10; j+
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //敲桌子 //输出1-100; for (int i = 1; i <= 100; i++) { //从100个数字找到特殊数字,打印敲桌子 //如果是7的倍数,个位,十位有7,打印敲桌子 
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //for循环 //从数字0打印数字9 for (int i = 0; i < 10; i++) { cout << i << endl; } system("pause"); return 
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //1.打印所有的三位数字 int num = 100; do {//2.从所有三位数字找到水仙花数 int a = 0; int b = 0; int c = 0; int d = 0; a
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //do...while语句 //在屏幕中输出0到9这10个数字 int num = 0; do { cout << num << endl; num++; } while (num < 10
        阅读全文
                
摘要:#include <iostream> #include <time.h> using namespace std; int main() { //生成随机数 //添加随机数种子,作用利用当前系统时间生成随机数,防止每次随机数都一样 srand((unsigned int)time(NULL)); 
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //while语句 //屏幕打印0-9,这10个数字 //避免死循环 int i = 0; while (i<10) { cout << i<< endl; i++; } system("pa
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //switch语句 //给一个电影打分 int fen; cout << "清输入一个分数" << endl; cin >>fen; cout <<"你输入的是"<< fen <<"分"<<
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //三目运算符 //创建三个变量A B C //A和B比较,将变量大得赋值变量C int a = 10; int b = 20; int c = 0; c = (a > b ? a : b);
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //三只小猪秤体重 //先判断A和B谁重 //A重 让A和C比较 //A重 结果时A重 //C重 结果时C重 //B重 让B和C比较 //B重 结果时B重 //C重 结果时C重 int num
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //选择结构 单行if语句 //用户输入分数,如果分数大于600,视为考上一本大学,在屏幕上输出 //1.用户输入分数 int scroe = 0; cout << "请输入一个分数:" <<
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //选择结构 多条件if语句 //输入一个考试分数,如果大于600分,视为考上一本大学,在屏幕输出 //大于500,视为二本大学,在屏幕输出 //大于400,视为三本大学,在屏幕输出 //小于
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //选择结构 多行if语句 //用户输入分数,如果分数大于600,视为考上一本大学,在屏幕上输出, //如果没考上,打印未考上 //用户输入分数 int score = 0; cout << 
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //选择结构 单行if语句 //用户输入分数,如果分数大于600,视为考上一本大学,在屏幕上输出 //1.用户输入分数 int scroe = 0; cout << "请输入一个分数:" <<
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //逻辑运算符 或 ||,同假为假,其余为真 int a = 10; int b = 10; cout << (a || b) << endl;//结果真 a = 0; b = 10; cou
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //逻辑运算符 与 && 同真为真,其余为假 int a = 10; int b = 10; cout << (a&&b)<< endl;//都真 a = 0; b = 10; cout <<
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //逻辑运算符!非,真变假,假变真 int a = 10; cout << !a << endl;//在c++中,除了0都为真 cout << !!a << endl; system("pau
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //比较运算符 int a = 10; int b = 20; //== cout << (a == b) << endl;//a等于b,结果0 //!= cout << (a != b) <
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //赋值运算符; // = int a = 10; a = 100;//赋值 cout << "a=" << a << endl; // += a = 10; a += 2;//a=a+2; 
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //1.前置递增; int a = 10; ++a;//让变量+1 cout <<"a="<< a << endl; //2.后置递增; int b = 10; b++;//让变量+1 cou
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //取模运算,就是求余数,运算符% int a = 10; int b = 3; cout << a % b << endl; int a2 = 10; int b2 = 20; cout <
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //加减乘除 int a = 10; int b = 3; cout << a + b << endl; //加 cout << a - b << endl; //减 cout << a * 
        阅读全文
                
摘要:#include <iostream> #include <string> using namespace std; int main() { //1.整数 int num1 = 0; cout << "请输入整型变量num1赋值" << endl; cin >> num1; cout << "整型
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //1.创建bool类型 bool flag = true; //true代表真 bool flag1 = false; //false代表假 cout <<flag<< endl; //本质
        阅读全文
                
摘要:#include <iostream> #include <string> using namespace std; int main() { //1.C风格字符串 //注意事项char字符串名[] //注意事项等号后面双引号 char str[] = "C语言风格"; cout << str <<
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //转义字符 //换行符\n cout << "你好啊\n学生"; //反斜杠\\ cout << "\\" << endl; //水平制表符\t 作用整齐 cout << "aaa\thel
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //1.字符型变量创建方式,单引号,引号内只有一个字符 char ch = 'd'; //2.字符型变量所占用内存大小(1个字节) cout << sizeof(char) << endl; 
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //1.单精度 float //2.双精度 double //默认情况下,输出一个小数,会显示出6位有效数字 float f1 = 3.14f; double d1 = 3.1415926; 
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //整型shaort(2),int(4),long(4),long long(8) //可以利用sizeof求出数据类型占用的内存大小; //语法:sizeof(数据类型或变量) short 
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //整型 //1.短整型short (-32768 到 32767) short num1 = 10; //2.整型int (-2147483648 到 2147483647) int num
        阅读全文
                
摘要:#include <iostream> using namespace std; //标识符命名规则 //1.标识符不可以是关键字 //2.标识符是由字母,数字,下划线构成 //3.标识符第一字符只能是字母或下划线 //4.标识符是区分大小写的 int main() { //1.标识符不可以是关键字
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //int int = 10; 错误,第二个int 是关键字,不能关键字做变量常量 system("pause"); return 0; }
        阅读全文
                
摘要:#include <iostream> using namespace std; //常量的定义方式 //1.#define宏常量 //2.const修饰的变量 //1.#define宏常量 #define Day 7 int main() { //2.const修饰的变量 const int mo
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { //变量的创建语法:数据类型 变量名=变量初始值 int num=10;//创建一个整数变量num,并且把10赋值给这个变量 cout<<num<<endl;//输出变量num的值 syste
        阅读全文
                
摘要:#include <iostream> using namespace std; //1.单行注释 // //2.多行注释 /* main是程序的入口, 每个程序都必须有一个 */ int main() { //11行在屏幕输出helloword cout << "helloword" << end
        阅读全文
                
摘要:#include <iostream> using namespace std; int main() { cout<<"hello word"<<endl; system("pause"); return 0; }
        阅读全文
                
 
                     
                    
                 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号