随笔分类 - 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 =...
阅读全文
摘要:#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
阅读全文
摘要:#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取余得到十
阅读全文
摘要:#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; ...
阅读全文
摘要:#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 << "
阅读全文
摘要:#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; /
阅读全文
摘要:#include <iostream> #include <Windows.h> #include <string> using namespace std; int main(void) { char x; cout << "请输入一个字符:"; cin >> x; //利用ASCII码表中的字符排列规律进行字母的大小写转换 if (x >= 'a' && x <= 'z') { //小写字母
阅读全文
摘要:C++ 统计用户输入的总行数和字符长度
阅读全文
浙公网安备 33010602011771号