自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 收藏
  • 关注

原创 2020.3.3 选择结构综合编程(买钢笔)

买钢笔程序框图#include<stdio.h>#include<stdlib.h>int main(){ int x;//money int fourPen=0,fivePen=0,sixPen=0;//pen numbers int remain=0; printf("input money>=8:\n"); scanf("%d",&amp...

2020-03-03 19:12:18 486

原创 2020.3.3 成绩等级判断

成绩等级判断if语句和switch语句if语句#include<stdio.h>int main(){ float score; printf("请输入你的考试成绩"); scanf("%f",&score); if(score>=90 && score<=100) { printf("优秀!\n"); } else if(...

2020-03-03 13:27:37 346

原创 2020.3.3 逻辑运算中后++的使用

后++的使用#include<stdio.h>int main(){ int a=0,b=1,c; c=(a>=b)||(b++>1); printf("a=%d\nb=%d\nc=%d",a,b,c); return 0;}易错点:实际上是进行的b=1,1>1,c=0,b=1+1=2。则a=0,b=2,c=0....

2020-03-03 09:11:17 193

原创 2020.3.3 逻辑运算

逻辑运算#include<stdio.h>int main(){ int x=3; int y=4; (++x == 3) && (y++ == 4); printf("x:%d \ny:%d",x,y); return 0;}易错点:++x等于4,所以&&左边为假,运算结果为假,没有进行右边的运算,结果中y还是为4.对比:#i...

2020-03-03 08:39:15 179

原创 2020.2.29 计算火车运行时间

计算火车运行时间#include<stdio.h>int main(){ int A,B,a,b,c,d,e,f; scanf("%d %d",&A,&B); a=A%100; b=B%100; c=A/100; d=B/100; f=b-a; e=d-c; if(a>b){...

2020-03-01 15:06:39 611

原创 2020.2.29 分段函数(阶梯电价)

阶梯电价#include<stdio.h>int main(void){ int x; double cost; scanf("%d", &x); if(x > 50){ cost = 50*0.53+(x-50)*0.58; printf("cost = %.2f", cost); } else if(x>0){ cost = ...

2020-03-01 14:59:21 1876

原创 2020.2.26 计算时间差

计算两个时间的时间差#include<stdio.h>int main(){ int hour1,minute1,a; int hour2,minute2,b; int c; scanf("%d,%d",&hour1,&minute1); scanf("%d,%d",&hour2,&minute2); a = hour1*60+m...

2020-02-26 13:50:09 275

原创 2020.2.26 求平均值

求a和b的平均值;比较以下两种写法:一#include<stdio.h>int main(){ int a,b; scanf("%d,%d",&a,&b); printf("%d和%d的平均值是%d",a,b,(a+b)/2); return 0;}二#include<stdio.h>int main(){ int a...

2020-02-26 13:46:48 142

原创 2020.2.26 scanf输入(求矩形的面积)

求矩形的面积#include<stdio.h>int main(){ int ilength,iwidth,irectanglearea; printf("please input rectangle length and width,as 3,4\n"); scanf("%d,%d",&ilength,&iwidth); irectangleare...

2020-02-26 09:56:40 325

原创 2020.2.26 数学函数(吃苹果问题)

吃苹果问题一共有n个苹果,虫子每小时吃x个苹果,吃了y个小时,请问还有多少个苹果?#include<stdio.h>#include<math.h>int main(){ double x,y; int appleNums; int remainAppleNums; printf("please input rate:\n"); scanf...

2020-02-26 09:51:29 892

原创 2020.2.26 数据占位输出一致性

数据占位输出一致性#include<stdio.h>#define PI 3.14int main(){ double r; double area; r = 2; area =PI*r*r; printf("area of cirle(r=%.0Lf) : %.2Lf",r,area); return 0;}易错点:定义r和area都是double,则...

2020-02-26 08:21:44 200

原创 2020.2.25 数据的溢出和兼容

数据的溢出和兼容#include<stdio.h>int main(){ char b=130; printf("%d",b); return 0;}错误点:char是一字节,130是两字节,数据发生了截断,溢出。将char改为4或8字节的 int 可解决问题。注意:赋值时需要考虑数据兼容性和数据一致性。(最好左右数据类型保持一致)...

2020-02-25 20:53:00 94

原创 2020.2.25 求123的个十百位

求123的个十百位易错点:输出紧跟计算后,因为data对于每个的数值不一样。

2020-02-25 20:45:18 459

原创 2020.2.25 常量定义(计算圆的面积)

2.25 学习常量#include<stdio.h>int main(){double area;double circumference;double r;r=2;area=3.14*r*r;circumference=2*3.14*r;printf("area of cirle(r=%.0f):%.2f\n",r,area);printf("circum...

2020-02-25 20:39:35 369

原创 PTA作业 7-12 I Love GPLT (20分)

7-12 I Love GPLT (20分)#include<stdio.h>int main(){ printf("I\n"); printf(" \n"); printf("L\n"); printf("o\n"); printf("v\n"); printf("e\n"); printf(" \n"); pr...

2020-02-25 20:26:41 1306

原创 PTA作业 7-5 输出带框文字

7-5 输出带框文字 (20分)本题要求编写程序,输出指定的带框文字。输入格式:本题无输入输出格式:按照下列格式输出带框文字。Welcome#include<stdio.h>int main(){ printf("************\n"); printf(" Welcome\n"); printf("************\n"...

2020-02-25 20:26:33 493

原创 PTA作业 7-6 计算平均分 (20分)

7-6 计算平均分 (20分)#include<stdio.h>int main(){ printf("math = 87, eng = 72, comp = 93, average = %d",(87+72+93)/3); return 0;}易错点:输出必须和题目完全一致,注意检查空格和%d位置。...

2020-02-25 20:26:15 2456

空空如也

空空如也

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

TA关注的人

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