随笔分类 -  C++

摘要:#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 你爱过大海我爱过你 阅读(2545) 评论(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 你爱过大海我爱过你 阅读(1891) 评论(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 你爱过大海我爱过你 阅读(714) 评论(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 你爱过大海我爱过你 阅读(739) 评论(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 你爱过大海我爱过你 阅读(273) 评论(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 你爱过大海我爱过你 阅读(3160) 评论(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 你爱过大海我爱过你 阅读(5545) 评论(0) 推荐(0)
摘要:C++ 统计用户输入的总行数和字符长度 阅读全文
posted @ 2019-08-10 12:04 你爱过大海我爱过你 阅读(623) 评论(0) 推荐(0)
摘要:输出结果 阅读全文
posted @ 2019-07-31 10:04 你爱过大海我爱过你 阅读(635) 评论(0) 推荐(0)