mark reilly
/
Counting_Machine_V6
final form
Diff: main.cpp
- Revision:
- 6:21c45f712206
- Parent:
- 5:cb60f96b36c9
- Child:
- 7:b522dd5a5d39
--- a/main.cpp Tue Nov 06 11:11:29 2018 +0000 +++ b/main.cpp Wed Nov 21 16:26:03 2018 +0000 @@ -34,7 +34,7 @@ int main() { - pc.baud(921600); + //pc.baud(921600); float a[8]={0,0,0,0,0,0,0,0}; //number of 1p coins int n[8]={0,0,0,0,0,0,0,0}; //amount of 1p coins float v[8]={0.01,0.02,0.05,0.1,0.2,0.5,1,2};// value of coins @@ -141,7 +141,8 @@ ta = a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]; //lcd.locate(0,0); - pc.printf("Your total value is %d %c.",ta,char(163)); + //pc.printf("Your total value is %d %c.",ta,char(163)); + pc.printf( "your total value is %f %c.",ta,char(163)); wait(5); system("CLS"); @@ -172,14 +173,23 @@ { if (switch1 == 1) { - an++; - if (an > 8) - { - an = 1; - } + + // an++; + // if (an > 8) + // { + // an = 1; + // } //pc.cls(); + + + system("CLS"); pc.printf("Do you want to see the number of %d %c coins?",v[an],char(163)); + na++; + if (an > 7); + { + an= 0 ; + } wait(3); //button1 = 0; }