Advertisement
Eather

7 segment Display

May 20th, 2011
690
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.51 KB | None | 0 0
  1.                            /*in the name of Allah */
  2. # include <list>
  3. # include <deque>
  4. # include <bitset>
  5. # include <algorithm>
  6. # include <functional>
  7. # include <numeric>
  8. # include <utility>
  9. # include <sstream>
  10. # include <iostream>
  11. # include <iomanip>
  12. # include <cstdio>
  13. # include <cmath>
  14. # include <cstdlib>
  15. # include <ctime>
  16. # include <set>
  17. # include <map>
  18. # include <cmath>
  19. # include <queue>
  20. # include <limits>
  21. # include <stack>
  22. # include <vector>
  23. # include <cstring>
  24. # include <cstdio>
  25. using namespace std;
  26.  
  27. # define MEM(array,w)   memset(array,w,sizeof array)
  28. # define ULL unsigned long long
  29. # define eps 1e-9
  30. # define SS stringstream
  31. # define FOR(i, a, b) for (int i=a; i<b; i++)
  32. # define REP(i, a) FOR(i, 0, a)
  33. # define rive(s) reverse(s.begin(),s.end())
  34. # define PII pair<int , int>
  35. # define MPSS map<string, string>
  36. # define MPIS map<int, string>
  37. # define MPSI map<string, int>
  38. # define MPII map<int, int>
  39. # define MPIC map<int,char>
  40. # define MPCI map<char, int>
  41. # define all(c) (c).begin(), (c).end()
  42. # define VS vector<string>
  43. # define VI vector<int>
  44. # define VC vector<char>
  45. # define VB vector<bool>
  46. # define sz(x) x.size()
  47. # define pb push_back
  48. # define STI set<int>
  49. # define STC set<char>
  50. # define STS set<string>
  51. # define OK(R,C) if(i<0 && j<0 && j==C && i==R)
  52.  
  53. template<class T> string toString(T n){ostringstream ost;ost<<n;ost.flush();return ost.str();}
  54.  
  55. int toInt(string s){int r=0;istringstream sin(s);sin>>r;return r;}
  56.  
  57. char one(int k)
  58. {
  59.     cout<<endl;
  60.   for(int i=0;i<k;i++)
  61.   cout<<'|'<<endl;
  62.   cout<<" "<<endl;
  63.   for(int i=0;i<k;i++)
  64.   cout<<'|'<<endl;
  65. }
  66. char two(int k)
  67. {
  68.   cout<<" ";
  69.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  70.   for(int i=0;i<k;i++)
  71.   {
  72.     for(int j=0;j<k+1;j++)cout<<" ";
  73.     cout<<'|'<<endl;
  74.   }
  75.   cout<<" ";
  76.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  77.   for(int i=0;i<k;i++)
  78.   {
  79.     cout<<'|'<<endl;
  80.   }
  81.     cout<<" ";
  82.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  83. }
  84.  
  85. char three(int k)
  86. {
  87.     cout<<" ";
  88.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  89.   for(int i=0;i<k;i++)
  90.   {
  91.     for(int j=0;j<k+1;j++)cout<<" ";
  92.     cout<<'|'<<endl;
  93.   }
  94.   cout<<" ";
  95.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  96.  
  97.  for(int i=0;i<k;i++)
  98.   {
  99.     for(int j=0;j<k+1;j++)cout<<" ";
  100.     cout<<'|'<<endl;
  101.   }
  102.   cout<<" ";
  103.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  104. }
  105.  
  106. char four(int k)
  107. {cout<<endl;
  108.   for(int i=0;i<k;i++)
  109.   {
  110.     cout<<'|';
  111.     for(int j=0;j<k;j++)cout<<" ";
  112.     cout<<'|'<<endl;
  113.   }
  114.   cout<<" ";
  115.   for(int i=0;i<k;i++)cout<<'-';
  116.   cout<<" "<<endl;
  117.   for(int i=0;i<k;i++)
  118.   {
  119.     for(int j=0;j<k+1;j++)cout<<" ";
  120.     cout<<'|'<<endl;
  121.   }
  122. }
  123.  
  124. char five(int k)
  125. {
  126.   cout<<" ";
  127.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  128.   for(int i=0;i<k;i++)
  129.   {
  130.     cout<<'|'<<endl;
  131.   }
  132.   cout<<" ";
  133.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  134.   for(int i=0;i<k;i++)
  135.   {
  136.     for(int j=0;j<k+1;j++)cout<<" ";
  137.     cout<<'|'<<endl;
  138.   }
  139.     cout<<" ";
  140.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  141. }
  142.  
  143. char six(int k)
  144. {
  145.  
  146.  cout<<" ";
  147.  for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  148.  for(int i=0;i<k;i++)cout<<'|'<<endl;
  149.   cout<<" ";
  150.  for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  151.  for(int i=0;i<k;i++)
  152.   {
  153.     cout<<'|';
  154.     for(int j=0;j<k;j++)cout<<" ";
  155.     cout<<'|'<<endl;
  156.   }
  157.   cout<<" ";
  158.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  159.  
  160. }
  161. char seven(int k)
  162. {
  163.  
  164.   cout<<" ";
  165.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  166.   for(int i=0;i<k;i++)
  167.   {
  168.     for(int j=0;j<k+1;j++)cout<<" ";
  169.     cout<<'|'<<endl;
  170.   }
  171.     cout<<" "<<endl;
  172.      for(int i=0;i<k;i++)
  173.   {
  174.     for(int j=0;j<k+1;j++)cout<<" ";
  175.     cout<<'|'<<endl;
  176.   }
  177.   cout<<" "<<endl;
  178. }
  179. char eight(int k)
  180. {
  181.  
  182.  cout<<" ";
  183.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  184.   for(int i=0;i<k;i++)
  185.   {
  186.     cout<<'|';
  187.     for(int j=0;j<k;j++)cout<<" ";
  188.     cout<<'|'<<endl;
  189.   }
  190.   cout<<" ";
  191.   for(int i=0;i<k;i++)cout<<'-';
  192.   cout<<" "<<endl;
  193.   for(int i=0;i<k;i++)
  194.   {
  195.     cout<<'|';
  196.     for(int j=0;j<k;j++)cout<<" ";
  197.     cout<<'|'<<endl;
  198.   }
  199.   cout<<" ";
  200.   for(int i=0;i<k;i++)cout<<'-';
  201.   cout<<" "<<endl;
  202. }
  203.  
  204. char nine(int k)
  205. {
  206.  cout<<" ";
  207.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  208.   for(int i=0;i<k;i++)
  209.   {
  210.     cout<<'|';
  211.     for(int j=0;j<k;j++)cout<<" ";
  212.     cout<<'|'<<endl;
  213.   }
  214.   cout<<" ";
  215.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  216.   for(int i=0;i<k;i++)
  217.   {
  218.     for(int j=0;j<k+1;j++)cout<<" ";
  219.     cout<<'|'<<endl;
  220.   }
  221.     cout<<" ";
  222.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  223. }
  224.  
  225. char zero(int k)
  226. {
  227.    cout<<" ";
  228.   for(int i=0;i<k;i++)cout<<'-';cout<<" "<<endl;
  229.   for(int i=0;i<k;i++)
  230.   {
  231.     cout<<'|';
  232.     for(int j=0;j<k;j++)cout<<" ";
  233.     cout<<'|'<<endl;
  234.   }
  235.   cout<<" ";
  236.   for(int i=0;i<k;i++)cout<<' ';
  237.   cout<<" "<<endl;
  238.   for(int i=0;i<k;i++)
  239.   {
  240.     cout<<'|';
  241.     for(int j=0;j<k;j++)cout<<" ";
  242.     cout<<'|'<<endl;
  243.   }
  244.   cout<<" ";
  245.   for(int i=0;i<k;i++)cout<<'-';
  246.   cout<<" "<<endl;
  247. }
  248.  
  249. void delay(int n)
  250. {
  251.     for(int i=0;i<60000;i++)for(int j=0;j<n;j++){}
  252. }
  253. int main()
  254. {
  255.  
  256. int n;string s;
  257. rep:
  258. cout<<"Length; ";cin>>n;
  259. int time;
  260. cout<<"How long will continue: ";cin>>time;
  261. int i=0;
  262. system("cls");
  263. cout<<"Start?";
  264. getchar();getchar();
  265.  
  266. start:
  267.   cout<<zero(n)<<endl<<"  Your counting is now at "<<i<<endl;delay(6000);system("cls");
  268.  
  269.   cout<<one(n)<<endl<<"  Your counting is now at "<<i<<endl;delay(6000);system("cls");
  270.  
  271.   cout<<two(n)<<endl<<"  Your counting is now at "<<i<<endl;delay(6000);system("cls");
  272.  
  273.   cout<<three(n)<<endl<<"  Your counting is now at "<<i<<endl;delay(6000);system("cls");
  274.  
  275.   cout<<four(n)<<endl<<"  Your counting is now at "<<i<<endl;delay(6000);system("cls");
  276.  
  277.   cout<<five(n)<<endl<<"  Your counting is now at "<<i<<endl;delay(6000);system("cls");
  278.  
  279.   cout<<six(n)<<endl<<"  Your counting is now at "<<i<<endl;delay(6000);system("cls");
  280.  
  281.   cout<<seven(n)<<endl<<"  Your counting is now at "<<i<<endl;delay(6000);system("cls");
  282.  
  283.   cout<<eight(n)<<endl<<"  Your counting is now at "<<i<<endl;delay(6000);system("cls");
  284.  
  285.   cout<<nine(n)<<endl<<"  Your counting is now at "<<i<<endl;delay(6000);system("cls");
  286.  
  287.   i++;if(i==time){cout<<"FINISH. Continued until: "<<i<<endl;char r;
  288.   q:
  289.   cout<<"Want to count again? Press Y for YES, N for NO ";cin>>r;if(r=='Y')goto rep;
  290.   else if(r=='N')return 0;else {cout<<"Wrong input. Press Y for YES, N for NO";goto q;}
  291.   }
  292. goto start;
  293. cout<<"\n\n\n\n\n\n\nDesigned by Iftekhar ahmed eather,\nStudent of CSE (07 batch),\nBUBT, Mirpur";
  294. return 0;
  295.  
  296. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement