随笔分类 - 学习日记
C语言学习笔记
摘要:<!doctype html> <html> <head> <title>双色球号码随机生成</title> <script type="text/javascript"> function generateBall(){ var redBall = []; var blueBall; for(va
阅读全文
摘要:/***************随机生成彩票号码(双色球)***//**************编译器C4droid********************************/ #include <iostream> #include<stdio.h> #include<stdlib.h> #
阅读全文
摘要:using System.Threading.Tasks; using System.Threading; using System.Net.Sockets; using System.Net; Task t = new Task(() => { //To Do you code 也可以在这直接调用
阅读全文
摘要:1 ① 2 Control.CheckForIllegalCrossThreadCalls = false;//关闭安全检查,为了安全一般不采用此代码 3 4 5 ② 6 一般多线程代码:不能实现跨线程数据交互: 7 Thread thread = new Thread(new ThreadStar
阅读全文
摘要://定义随机数产生函数 static int GetRandomNumber(int min, int max) { int rtn = 0; Random r = new Random(); byte[] buffer = Guid.NewGuid().ToByteArray(); int iSe
阅读全文
摘要:bool dbExist = File.Exists("DB.sqlite"); //通过File.Exists函数判断数据库文件是否已经存在,BOOL返回值为真或者假(TURL FALSE) if (dbExist == false) //如果不存在,就创建
阅读全文
摘要:登录窗实例 (接收和处理数据) String Lusername = this.usernameDL.Text; // 获取并存储控件里面的内容 String Lpassword = this.passwordDL.Text; if (Lusername.Equals("") || Lpassword.Equals("")) //判断输入是否为空 MessageBox.Show("用户名或密码不能
阅读全文
摘要:#include //凑硬币题,1角,2角,5角凑10元,共有多少种组合 int main(){ int a,b,c,i=0; printf("有以下组合\n"); for(a=0;a<=100;a++) for(b=0;b<=50;b++) for(c=0;c<=20;c++) if(a*1+b*2+c*5==100){ i++; ...
阅读全文
摘要:编译环境:DEVCPP5.0 代码:
阅读全文
摘要:/*使用DEVC++5.0编译通过,新手朋友请注意,启动顺序为打开DEVC++ - 新建项目 - 新建windows application程序(这里不是控制台程序),然后新建HELLOWORD项目,清空MAIN.C代码,将本代码复制进去编译运行即可,具体功能通过修改C代码实现,大家自己去探索。代码保存为.C文件,直接打开无法通过*/截图: 代码如下:#include //#inclu...
阅读全文
摘要:#include<stdio.h> //定义一个函数判断素数 void sushu(int s){ int i,j,k=0; for(i=2;i<s;i++) if(s%i==0){ k=1; break; } if(k==1) printf("%d不是素数",s); if(k==0) printf("%d是素数"); return 0; } //验证 int main() { int a; wh
阅读全文
摘要:#include //定义一个3*3数组反转函数 void fan(int a[3][3]){ int i,j; int t[3][3]; for(i=0;i<3;i++) for(j=0;j<3;j++) t[i][j]=a[j][i]; for(i=0;i<3;i++){ for(j=0;j<3;j++) printf("%d ",t[i][j]); ...
阅读全文
摘要:本程序用DEVC++5.0编译
阅读全文
摘要:#include #include /*题目:将一个数组逆序输出*/ int main() { system("color 1F"); // 设定显示框为蓝底白字 system("mode con cols=80 lines=30"); //固定显示框尺寸 /******************************************程序主体分割线(顶部)*****...
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> /*题目:向数列中插入一个数*/ int main() { system("color 1F"); // 设定显示框为蓝底白字 system("mode con cols=80 lines=30"); //固定显示框尺寸 /******************************************程序主体分割线(顶
阅读全文
摘要:#include<stdio.h> /*题目:求3*3矩阵对角线之和*/ int main(){ int i,j,k,t; int a[3][3]; while(1){ printf("请依次输入矩阵数字\n"); k=0; for(i=0;i<3;i++) for(j=0;j<3;j++) scanf("%d",&a[i][j]); for(i=0;i<3;i++) for(j=0;j<3;j+
阅读全文
摘要:#include /*题目:利用冒泡法对10个数进行排序*/ int main(){ int i,j,k,t; int a[10]; while(1){ printf("——冒泡法排序——\n"); for(i=0;i<10;i++){ printf("请输入第%d个排序数字",i+1); scanf("%d",&a[i]); } for(j=0;j<9;j++) for(k=j+1;k...
阅读全文
摘要:#include /*题目:求100以内素数*/ int main(){ int i,j,k,m,n; lop: while(1){ printf("——列出m-n之间素数——\n请输入起始数:"); scanf("%d",&m); if(m<=1){ printf("输入错误,请重新输入"); goto lop;} printf("请输入终止数:"); scanf("%d",&n); for(...
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> /*题目:星期几的第一个字母来判断一下是星期几,如果第一个字母一样, 则继续判断第二个字母,直至找到唯一数据。这里我扩展为不限个数任意 一组数据*/ int main(){ int i,k,j1,j2,j3,j4,j5,j6,j7; char a; char w1[]="monday"; char w2[]="tuesday
阅读全文

浙公网安备 33010602011771号