Hari Prasad
/
O_gate
exp1b
main.cpp@0:ae2eec2171cd, 2015-06-18 (annotated)
- Committer:
- harseed951
- Date:
- Thu Jun 18 09:27:29 2015 +0000
- Revision:
- 0:ae2eec2171cd
exp1b;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
harseed951 | 0:ae2eec2171cd | 1 | #include "mbed.h" |
harseed951 | 0:ae2eec2171cd | 2 | |
harseed951 | 0:ae2eec2171cd | 3 | DigitalOut a(LED1),b(LED2),c(LED3),d(LED4); |
harseed951 | 0:ae2eec2171cd | 4 | |
harseed951 | 0:ae2eec2171cd | 5 | int main() { |
harseed951 | 0:ae2eec2171cd | 6 | while(1) { |
harseed951 | 0:ae2eec2171cd | 7 | int i=1,j=1,q,w,e; |
harseed951 | 0:ae2eec2171cd | 8 | q=i*j; |
harseed951 | 0:ae2eec2171cd | 9 | switch(q) |
harseed951 | 0:ae2eec2171cd | 10 | { |
harseed951 | 0:ae2eec2171cd | 11 | case 1: |
harseed951 | 0:ae2eec2171cd | 12 | a=1; |
harseed951 | 0:ae2eec2171cd | 13 | break; |
harseed951 | 0:ae2eec2171cd | 14 | case 0: |
harseed951 | 0:ae2eec2171cd | 15 | a=0; |
harseed951 | 0:ae2eec2171cd | 16 | break; |
harseed951 | 0:ae2eec2171cd | 17 | } |
harseed951 | 0:ae2eec2171cd | 18 | w=i+j; |
harseed951 | 0:ae2eec2171cd | 19 | if(w==0) |
harseed951 | 0:ae2eec2171cd | 20 | { |
harseed951 | 0:ae2eec2171cd | 21 | b=0; |
harseed951 | 0:ae2eec2171cd | 22 | } |
harseed951 | 0:ae2eec2171cd | 23 | if(w>=1) |
harseed951 | 0:ae2eec2171cd | 24 | { |
harseed951 | 0:ae2eec2171cd | 25 | b=1; |
harseed951 | 0:ae2eec2171cd | 26 | } |
harseed951 | 0:ae2eec2171cd | 27 | if(i==0) |
harseed951 | 0:ae2eec2171cd | 28 | { |
harseed951 | 0:ae2eec2171cd | 29 | c=1; |
harseed951 | 0:ae2eec2171cd | 30 | } |
harseed951 | 0:ae2eec2171cd | 31 | if (i==1) |
harseed951 | 0:ae2eec2171cd | 32 | { |
harseed951 | 0:ae2eec2171cd | 33 | c=0; |
harseed951 | 0:ae2eec2171cd | 34 | } |
harseed951 | 0:ae2eec2171cd | 35 | if(i==j) |
harseed951 | 0:ae2eec2171cd | 36 | { |
harseed951 | 0:ae2eec2171cd | 37 | d=0; |
harseed951 | 0:ae2eec2171cd | 38 | } |
harseed951 | 0:ae2eec2171cd | 39 | if(i!=j) |
harseed951 | 0:ae2eec2171cd | 40 | { |
harseed951 | 0:ae2eec2171cd | 41 | d=1; |
harseed951 | 0:ae2eec2171cd | 42 | } |
harseed951 | 0:ae2eec2171cd | 43 | } |
harseed951 | 0:ae2eec2171cd | 44 | |
harseed951 | 0:ae2eec2171cd | 45 | |
harseed951 | 0:ae2eec2171cd | 46 | } |
harseed951 | 0:ae2eec2171cd | 47 |