int main() {
int a = 0
int b = 0
int c = 0
int max = 0
scanf("%d%d%d",&a,&b,&c)
max = a > b ? a : b
max = max > c ? max : c
printf("%d\n", max)
return 0
} #include <stdio.h>
int main() {
int score
char grade
scanf("%d",&score)
if(score >= 90)
{
敏猜 grade = 'A'
}
else if(score >= 80 && score < 90)
{
grade = 'B'
}
else if(score >= 70 && score < 80)
{
grade = 'C'
}
else if(score >= 60 && score < 70)
{
grade = 'D'
}
轿拿让 else{
grade = 'E'
}
switch(grade)
{
case 'A':
printf("A")
break
case 'B':
闭局 printf("B")
break
case 'C':
printf("C")
break
case 'D':
printf("D")
break
case 'E':
printf("E")
break
}
return 0
} #include <stdio.h>
int main() {
int x = 0, y = 0
scanf("%d",&x)
if(x<1)
{
y = x
}
else if(x<10 && x>=1)
{
y = 2*x-1
}
else if(x>=10)
{
y = 3*x+11
}
printf("%d\n",y)
return 0
}
#include<stdio.h>void main()
{ float f=555.5678,ff
int a[10]={ 0,1,2,3,4,5,6,7,8,9 },b[10],i
FILE *fp
if ( fp=fopen("TEXT.dat","wb+") )
{ fwrite(&f,sizeof(float),1,fp)
for ( i=0i<10i++ ) fwrite(&a[i],sizeof(int),1,fp)
fclose(fp)
} else printf("无法拿携建立文纯敏橡件。\n")goto ERROREND
if ( fp=fopen("TEXT.dat"做旁,"rb") )
{ fread(&ff,sizeof(float),1,fp)
for ( i=0i<10i++ ) fread(&b[i],sizeof(int),1,fp)
fclose(fp)
} else printf("无法打开文件。\n")goto ERROREND
printf("%.2f ",ff)for ( i=0i<10i++ ) printf("%d ",b[i])printf("\n")
ERROREND:
}
#include <AT89X51.H>//单片机51头文知物件,存放着单片机的寄存器unsigned char dat//用于存储单片机接收发送缓冲寄存器SBUF里面的内容
sbit gewei=P2^2//个位选通定义
sbit shiwei=P2^3//十位选通定义
unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67,0x77,0x7c,0x39,0x5e,0x79,0x71}
//{0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67,}// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
void Delay(unsigned int tc) //延时程序
{
while( tc != 0 )
{unsigned int i
for(i=0i<100i++)
tc--}
}
void LED() //LED显示接收到的数据
{
shiwei=0
P0=~table[dat/16]
Delay(8)
shiwei=1
gewei=0
P0=~table[dat%16]
Delay(5)
gewei=1
}
void Init_Com(void)//功能:串口初始化,波特率9600,方式1
{
TMOD = 0x20
PCON = 0x00
SCON = 0x50
TH1 = 0xFd
TL1 = 0xFd
TR1 = 1
}
void main()//主扰空程序功能:实现接收数据并把接收到的数据原样发送回去///////
{
Init_Com()//串口初始化
// P1=0xf0
while(1)
{
if ( RI ) //扫描判断缓猛瞎是否接收到数据,
{
dat = SBUF //接收数据SBUF赋与dat
RI=0 //RI清零。
SBUF = dat //在原样把数据发送回去
}
LED()//显示接收到的数据
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)