摘要: 最近接到一个使用python写一个解析yaml文件,并根据内容配置指定对应的shell来执行(比如bat、powershell、bash、csh、zsh等)命令的功能,于是考虑使用subprocess.Popen模块来实现执行命令相关的功能,subprocess.Popen详细的参数这里不细述,自己 阅读全文
posted @ 2020-05-28 18:46 你爱过大海我爱过你 阅读(1773) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; #define N 256 void print_pyramid(int a[N][N], int lines); int main(void) { int n = 0; int a[N][N] = { 0 }; cout > n; for (int i =... 阅读全文
posted @ 2019-09-19 21:02 你爱过大海我爱过你 阅读(2514) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <Windows.h> #include <string> using namespace std; int main(void) { string str; int p = 1; //记录当前二进制权重 int s = 0; cout << "请输入一个二进制数:"; cin >> str; for (int i = str.length 阅读全文
posted @ 2019-09-01 23:49 你爱过大海我爱过你 阅读(1868) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; int main(void) { int n = 0; int ret[32]; int i = 0; cout > n; while (n != 0) { ret[i] = n % 2; n = n / 2; ... 阅读全文
posted @ 2019-08-30 23:46 你爱过大海我爱过你 阅读(1004) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <Windows.h> using namespace std; int main(void) { int a, b, c; for (int i = 100; i <= 999; i++) { a = i % 10; // 用变量i除10取余得到个位数 b = (i / 10) % 10; // 先对变量i除10,再对结果除10取余得到十 阅读全文
posted @ 2019-08-30 20:31 你爱过大海我爱过你 阅读(694) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; int main(void) { int width; for (int i = 1; i <= 9; i++) { for (int j = 1; j <= i; j++) { width = (j == 1) ? 1 : 2; ... 阅读全文
posted @ 2019-08-28 21:23 你爱过大海我爱过你 阅读(728) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <Windows.h> using namespace std; int main(void) { int row; cout << "请输入金字塔层数:"; cin >> row; for (int i = 1; i <= row; i++) { for (int k = 0; k < row - i; k++) { cout << " 阅读全文
posted @ 2019-08-28 20:47 你爱过大海我爱过你 阅读(253) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <Windows.h> using namespace std; int main(void) { int year; int month; int days = 0; bool flag; // 标记是否是闰年 cout << "请输入年份:"; cin >> year; cout << "请输入月份:"; cin >> month; / 阅读全文
posted @ 2019-08-18 11:50 你爱过大海我爱过你 阅读(3092) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <Windows.h> #include <string> using namespace std; int main(void) { char x; cout << "请输入一个字符:"; cin >> x; //利用ASCII码表中的字符排列规律进行字母的大小写转换 if (x >= 'a' && x <= 'z') { //小写字母 阅读全文
posted @ 2019-08-17 22:19 你爱过大海我爱过你 阅读(5459) 评论(0) 推荐(0) 编辑
摘要: 我们在VS2017中如果使用C语言的scanf输入函数,编译的时候编译器会报error C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprec 阅读全文
posted @ 2019-08-17 16:52 你爱过大海我爱过你 阅读(2882) 评论(3) 推荐(0) 编辑