摘要:
#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; 阅读全文
摘要:
#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 阅读全文
摘要:
#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( 阅读全文
摘要:
#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 阅读全文
摘要:
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 阅读全文