- 博客(2)
- 问答 (2)
- 收藏
- 关注
原创 C++与C的static静态变量
静态变量使用static说明符,跟普通变量(自动变量)对比一下:静态变量所在的函数执行一次后,它还能保持原来的那个值(占用的内存不被释放),自动变量所在的函数执行一次后,内存会被释放掉。 声明静态变量: static 变量类型 变量名 [=…]; #include<iostream> using namespace std; void addcount(int howmany){ static int count=0; //只会初始化一次 count+=howmany
2023-01-05 20:38:24
59
原创 无聊用c++写了个cmd
#include <bits/stdc++.h> #include <direct.h> using namespace std; void print_start() { cout << "自制cmd程序Loading...\n"; stringstream s; string s1; for(int i = 0;i <= 15;i++) { s << ":"; s >> s1; cout << s1; .
2022-03-02 19:03:56
424
1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人