当前位置:网站首页>C language - Blue Bridge Cup - 7 segment code
C language - Blue Bridge Cup - 7 segment code
2022-07-02 08:57:00 【@Xiaoyu~】
1. Import header file
2. Use enumeration to solve problems ( This question focuses on drawing )
3. The answer for 80
4. The attached total code is as follows
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
int sum = 0;
// Case one , Only one segment of diode emits light
int l1 = 7;//(a,b,c,d,e,f,g)
// The second case , There are two LEDs
int l2 = 10;//(ab,af,bc,bg,cg,cd,de,eg,ef,fg)
// The third case , There are three LEDs
int l3 = 16;//(abf,abc,abg,afg,afe,bcd,bcg,bgf,bge,cgd,cgf,cge,cde,cdg,deg,def,efg)
// The fourth situation , There are four LEDs
int l4 = 20;//(abcd,abcg,abcf,abge,abgf,abfe,afeg,bcde,bcdg,bcgf,bcge,bged,bgef,cdef,
//cdeg,cdgf,cgfa,cgfe,defg,defa)
// The fifth situation , There are five diodes that light up
int l5 = 19;//( Look for one with no light at both ends :ab,ac,ad,ae,af,ag,bc,bd,be,bg,cd,cf,cg,de,df,dg,ef,eg,fg)
// Sixth situation , There are six segments of diode light
int l6 = 7;//( Find a section of diode that doesn't light up :a,b,c,d,e,f,g)
// Situation 7 , All glow
int l7 = 1;//(abcdefg)
// Total statistics
sum = l1 + l2 + l3 + l4 + l5 + l6 + l7;
printf("%d\n", sum);
return 0;
}
边栏推荐
- C# 百度地图,高德地图,Google地图(GPS) 经纬度转换
- 整理秒杀系统的面试必备!!!
- HCIA - application layer
- Use of libusb
- Sqli labs level 12
- Minecraft air Island service
- Tcp/ip - transport layer
- commands out of sync. did you run multiple statements at once
- Classes and objects (instantiation of classes and classes, this, static keyword, encapsulation)
- Aneng logistics' share price hit a new low: the market value evaporated by nearly 10 billion yuan, and it's useless for chairman Wang Yongjun to increase his holdings
猜你喜欢
随机推荐
Shortcut key to comment code and cancel code in idea
Classes and objects (instantiation of classes and classes, this, static keyword, encapsulation)
gocv opencv exit status 3221225785
Select sort and insert sort
Kubernetes deploys Loki logging system
Function ‘ngram‘ is not defined
Minecraft模组服开服
Minecraft install resource pack
HCIA - data link layer
Dip1000 implicitly tagged with fields
libusb的使用
Pointer initialization
Qt的右键菜单
Sentinel easy to use
Tensorflow2 keras 分类模型
Sqli labs level 8 (Boolean blind note)
Minecraft空岛服开服
C# 调用系统声音 嘀~
Illegal use of crawlers, an Internet company was terminated, the police came to the door, and 23 people were taken away
QT -- how to set shadow effect in QWidget