自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(44)
  • 资源 (2)
  • 收藏
  • 关注

原创 C程序--从键盘键入一串字符,然后将他们存至磁盘

#include <stdio.h>#include <stdlib.h>int main(){ FILE *fp; char ch; if((fp = fopen("demo.txt","w")) == NULL ) { printf("failure to open demo.txt!\n"); ...

2020-03-25 14:48:00 1227

原创 C程序---编程统计候选人得票数

编程统计候选人得票数,假设有3个候选人,名字分别为Li,Zhang和Fun。使用结构体存储每一个候选人的名字和得票数。记录每一张选票的得票人名,输出每个候选人最终的得票数。#include <stdio.h>#include <stdlib.h>#include <string.h>#define N 10#define M 3typedef ...

2020-03-24 18:43:00 7875 2

原创 C程序---重新编写习题12.2程序,将其中Update()改用整除、取余运算来实现时钟值的更新

#include <stdio.h>void Updaet();void Updaet();void Display();typedef struct clock{ int hour ; int minute ; int second ;}CLOCK; CLOCK clok ; int main() { int i; // ...

2020-03-23 00:38:53 445

原创 C程序---定义时钟结构体,编写时钟函数==程序

#include <stdio.h>void Updaet();void Updaet();void Display();typedef struct clock{ int hour ; int minute ; int second ;}CLOCK; CLOCK clok ; int main() { int i; // ...

2020-03-23 00:21:45 2163

原创 C程序---设某大学有下列登记表,用结构体进行定义

#include<stdio.h>#define N 40typedef struct date{ int year; int month; int day;}DATE;typedef struct work{ char department[N]; char title[N]; char position[N];}WO...

2020-03-23 00:02:20 1076

原创 *p++ 、 (*p)++等辨析

*和++是同优先级操作符,且都是从右至左结合的*p++是指下一个地址(*p)++是指将*p所指的数据的值加一*(p++)是指是先取*p的值,再使p值+1;*(p--)是指先取*p所对应的数据,然后使p-1;*(++p)是指先对p+1,然后再取*p的值;*(--p)是指先使p-1,然后在进行*p运算++(*p)是指地址p所指的数据+1;例:int x,y,z,l,...

2020-03-22 23:36:49 4692 2

原创 C程序--用函数实现字符串连接

#include <stdio.h>#include <stdlib.h>#include <string.h>#define N 100void MyStrcat(char *b,char *a);int main(){ char a[N] , b[2*N] ; printf("please input string to a...

2020-03-21 18:15:55 1084

原创 C程序----用函数实现字符串复制函数

#include <stdio.h>#include <stdlib.h>#define N 100void MyString(char *b,char *a);int main(){ char a[N] , b[N] ; printf("please input a string: "); gets(a); MyString(...

2020-03-21 18:02:35 489

原创 C程序--字符串逆序输出(数组形式)

方法: 建立数组str【】 用于存放字符串; 建立数组temp【】 用于存放逆序的字符串 通过倒着遍历数组str【】,并把遍历结果存入temp【】从而实现改功能#include <stdio.h>#include <stdlib.h>#include <string.h>#define N 100void Re...

2020-03-21 15:26:31 3162

原创 C程序---在字符串每个字母中插入空格 (指针形式)

思路一:1、建立数组str[ ]存输入的字符串,在建数组temp[ ];2、比较str数组第一个元素与第二个元素是否为空格, 若不是,则str的第一个元素元素赋值给’temp【0】,并将temp【1】赋值为空格,在进入下次循环; 若是,则 跳出本次循环,进行下一循环;3、考虑字符串间原本有一个空格情况#include <stdio.h>#i...

2020-03-21 12:21:58 2348

原创 C程序---在字符串每个字母中插入空格 (数组形式)

思路一:1、建立数组str[ ]存输入的字符串,在建数组temp[ ];2、比较str数组第一个元素与第二个元素是否为空格, 若不是,则str的第一个元素元素赋值给’temp【0】,并将temp【1】赋值为空格,在进入下次循环; 若是,则 跳出本次循环,进行下一循环;3、考虑字符串间原本有一个空格情况#include <stdio.h>#i...

2020-03-21 12:16:31 7645

原创 C程序--在字符串中删除与某字符相同的字符(指针形式)

思想:1、建立一个数组存字符串 如 aabbcc 2、拿出第一个字母与后面字母依次比较,若不同则什么也不做; 若相同,则除第一个字母之外,后面字母依次往前移动一个字母位置,将第二个a覆盖到#include <stdio.h>#include <stdlib.h>#define N 80void De...

2020-03-21 00:02:55 5046 2

原创 C程序--在字符串中删除与某字符相同的字符(数组形式)

思想:1、建立一个数组存字符串 如 aabbcc 2、拿出第一个字母与后面字母依次比较,若不同则什么也不做; 若相同,则除第一个字母之外,后面字母依次往前移动一个字母位置,将第二个a覆盖到#include <stdio.h>#include <stdlib.h>#define N 80void Delet...

2020-03-20 23:51:37 3262 2

原创 C程序--输入一行字符,用函数实现统计其中有多少个单词,假设单词之间以空格分开

#include <stdio.h>#include <stdlib.h>#define N 80int main(){ char s[N]; int i,num=0 ; printf("please input string:"); gets(s); for(i = 0 ; s[i] != '\0' ; i++) ...

2020-03-20 12:57:44 1697

原创 对三个整数从大到小排序 C语言

#include <stdio.h>#include <stdlib.h>int main(){ int a,b,c,first,second,third; printf("please input num:"); scanf("%d%d%d",&a,&b,&c); if(a > b ) { ...

2020-03-19 15:41:46 1695 1

原创 C程序--输入某年的第几天,计算并输出这是第几年的几月几天

#include <stdio.h>#include <stdlib.h>int LeapYear(int year);void MonthDay(int year, int yearDay , int *pMonth , int *pDay);#define MONTHS 12main(){ int year,yearDay,*pMonth=NU...

2020-03-19 15:40:45 781

原创 C程序---日期转换问题---输入某年某月,计算并输出它是这一年的第几天

#include <stdio.h>#include <stdlib.h>int DayofYear(int year, int month ,int day);int LeapYear(int year);#define MONTHS 12main(){ int day,month,year,days; do{ print...

2020-03-19 14:55:19 752

原创 C程序--用函数实现两数组中对应值交换

#include <stdio.h>#include <stdlib.h>#define N 5void Swap(int x[], int y[]);void GetValue(int array[]); void PrintValue(int array[]); main(){ int A[N],B[N]; printf("please ...

2020-03-19 14:03:47 2394

原创 C程序--参考例8.7程序中的函数,输入10个整数,用函数编程蒋其中最大最小数位置互换,然后输出互换后的数组

#include<stdio.h>#define N 10 void GetValue(int array[]) ; int FindMax(int array[]); int FindMin(int array[]); void SwapArr(int array[]); main() { int array[N],i; GetValue(ar...

2020-03-18 23:56:02 3315 3

原创 C程序--用函数编程通过返回数组中最大元素下标,并输出成绩最高分与其学号

#include <stdio.h>#include <stdlib.h>#define N 40int ReadScore(int score[],long ID[]);int FindMax(int score[] ,int n);long FindID(int score[] , long ID[] ,int n); main(){ int...

2020-03-18 21:56:49 1559

原创 C程序---用函数编程统计成绩高于平均分的学生人数

#include <stdio.h>#include <stdlib.h>#define N 40int ReadScore(int score[]);int HighScore(int score[] ,int n);int Average(int score[] , int n); main(){ int average,n,score[N],...

2020-03-18 17:24:54 5623

原创 C程序--输入某班学生某课程成绩,用函数统计不及格人数

#include <stdio.h>#include <stdlib.h>#define N 40int ReadScore(int score[]); int LowScore(int score[] ,int n); main(){ int n,score[N],count; n = ReadScore(score); printf(...

2020-03-18 16:42:14 5781

原创 C程序 计算两个正整数的最小公倍数

计算最小公倍数的方法:https://wenku.baidu.com/view/92ad50d3a58da0116c174989.html此代码采用1、两数相乘法2、扩大法详情参考上面链接#include <stdio.h>#include <stdlib.h>main(){ int i = 1,data1,data2...

2020-03-17 23:53:15 2340

原创 C程序 ---用函数计算两个整数的最大值

#include<stdio.h>#include<stdlib.h> int GetMax(int data1,int data2); main() { int data1,data2,max; printf("please enter data; "); scanf("%d%d",&data1,&data2)...

2020-03-17 17:23:04 4537

原创 C程序 用全局变量编程模拟显示一个数字时钟

#include <stdio.h>#include <stdlib.h>int hour,minute,second;void Update(){ second++; if (second == 60) { second = 0; minute ++; } if (minute == 60)...

2020-03-17 17:13:49 1031

原创 C程序计算 1! + 2! + 3! +_....+n! 的值

法一#include <stdio.h>#include <stdlib.h> main(){ int i,j,p,sum=0,n; printf("please enter n "); scanf("%d",&n); for(i = 0; i<= n; i++) { p = 1; ...

2020-03-16 11:00:33 19511 1

原创 C程序--从键盘输入n,计算1~n之间的阶乘值

#include <stdio.h>#include <stdlib.h> main(){ int i,product = 1 ,n; printf("please enter number "); scanf("%d",&n); for(i = 1 ; i <= n ; i++) { product *= i; }...

2020-03-16 10:28:22 6275

原创 C程序--从键盘输入n ,计算1+2+3+.....+n 的值

法一:for语句#include <stdio.h>#include <stdlib.h>main(){ int n,i,sum = 0; printf("please input number "); scanf("%d",&n); for( i = 1 ; i <= n ; i++) { sum +=...

2020-03-16 00:15:45 38236 4

原创 C程序----五分制A,,B,C,D,E成绩输出

输入百分制成绩分数,转换成五分制成绩输出#include <stdio.h>#include <stdlib.h> main(){ int score ,grade; printf("please input score:"); scanf("%d",&score); if(score >= 0 &&...

2020-03-16 00:01:16 2047

原创 C程序---判断输入字符类型

输入一个字符,判断输出是数字字符、大写字母、小写字母还是其他字符#include <stdio.h>#include <stdlib.h> main(){ char ch; printf("press a key and then press enter:"); ch = getchar(); if((ch >= 0 &am...

2020-03-15 23:20:25 12059 1

原创 C程序---英文字母大小写转换与ASCII ,非英文字母ASCII值

#include <stdio.h>#include <stdlib.h> main(){ char ch; printf("press a key and then press enter:"); ch = getchar(); if(ch >= 'A' && ch <= 'z') { ...

2020-03-15 23:00:39 469

原创 C程序 --- 判断闰年平年以及二月天数

闰年满足条件(1)能被4整除,但不能被100整除或(2)能被400整除#include <stdio.h>#include <stdlib.h>#include <math.h> main(){ int year,flag; printf("please enter year:"); scanf("%d",&...

2020-03-15 22:19:18 2075

原创 C 程序编写--计算存款利息

收益=本金+利息单位时间利息 =本金*利息率收益P ,本金P1,利息率x%,时间(通常为年数)n公式 P=P1(1+x%)^n#include <stdio.h>#include <stdlib.h>#include <math.h> main(){ float capital , income ; int year;...

2020-03-15 22:04:36 6445

原创 用C程序 计算三角形面积

#include <stdio.h>#include <stdlib.h>#include <math.h> main(){ float a,b,c,s,area; printf("please enter nums: "); scanf("%f%f%f",&a,&b,&c); if((a+b > c) &...

2020-03-15 21:45:55 1236

原创 C-输入一个数,判断奇数偶数

#include <stdio.h>#include <stdlib.h>#define EPS 1e-7 main(){ int a; printf("please enter a num:"); scanf("%d",&a); if( a != 0) { if(a % 2 == 0 ) ...

2020-03-15 21:05:55 1446

原创 用C语言编程 不使用计算绝对值函数编程计算并输出该实验的绝对值

#include <stdio.h>#include <stdlib.h>#define EPS 1e-7main(){ float a; printf("please enter a num:"); scanf("%f",&a); if( a < EPS) printf("%f\n",a*(-1));...

2020-03-15 20:51:17 3019

原创 C程序编写将输入的百分制成绩转换为五分制成绩输出

#include <stdio.h>#include <stdlib.h>main(){ int score ,mark; printf("please input score:"); scanf("%d",&score); mark = score < 0 || score >100 ? -1 : score/...

2020-03-15 15:31:58 8431

原创 C程序实现简单的计算器功能

#include <stdio.h>#include <stdlib.h>#include<math.h>#define EPS 1e-7int main(){ float data1,data2; char op; printf("please enter an expression:"); scanf("%f %...

2020-03-15 14:39:48 716

原创 计算并输出三个数的最大值

#include <stdio.h>#include <stdlib.h>int main(){ int a,b,c,max; printf("please input num:"); scanf("%d%d%d",&a,&b,&c); max = a > b ? a:b; max = max &...

2020-03-15 10:30:58 444

原创 字母大小写转换 C

#include <stdio.h>#include <stdlib.h>int main(){ char ch; printf("press a key and then press enter:"); ch = getchar(); if(ch <= 'z' && ch >='a') c...

2020-03-13 18:59:04 270

RAD5807.zip

此文件是用arduino和rda5807m模块做收音机时需要的库文件,这个库是从github上下载下来,便于大家下载,我将此开源文件上传。

2019-03-12

STM32F4 定时器中断+万历表

这是自己在32开发板上做的小实验的代码,代码风格有点糟糕,但还是实现了定时器中断和万历表的功能了。若读者有更好的方案,希望指点。

2018-08-05

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除