摘要: #include <stdio.h> class aclass{ private: int m; char c; public: aclass(int i, char ch) { printf("Constructor called.\n"); this->m = i; this->c = ch; 阅读全文
posted @ 2022-03-19 12:27 明月照江江 阅读(41) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> int switch1(int a, int b, int i){ switch (i){ case 1: return a + b; break; case 2: return a - b; break; case 3: return a * b; break 阅读全文
posted @ 2022-03-19 11:59 明月照江江 阅读(58) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> int dowhile(int n){ int i = 1; int s = 0; do{ s += i; }while(i++ < n); return s; } int whiledo(int n){ int i = 1; int s = 0; while( 阅读全文
posted @ 2022-03-19 11:40 明月照江江 阅读(41) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> void if1(int n){ //if else语句 if(n < 10){ printf("the number less than 10\n"); } else { printf("the number greater than or equal to 阅读全文
posted @ 2022-03-19 11:13 明月照江江 阅读(48) 评论(0) 推荐(0) 编辑
摘要: C源码 #include <stdio.h> int nums[5] = {1, 2, 3, 4, 5}; int for1(int n){ //普通for循环 int i = 0; int s = 0; for (i = 0; i < n; i++){ s += i * 2; } return s 阅读全文
posted @ 2022-03-19 10:30 明月照江江 阅读(47) 评论(0) 推荐(0) 编辑