Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #include <iostream>
  2. #include <thread>
  3. #include <windows.h>
  4. #include <conio.h>
  5.  
  6. using namespace std;
  7.  
  8. bool S1=false;
  9. bool S2=false;
  10. int turno=0,i;
  11. int h,cantI=0,Ckw=0,cantCkw=0,impulso=16000;
  12.  
  13. void acumulador()
  14. {
  15.     S1=true;
  16.     turno=2;
  17.  
  18.     while(S2==true && turno==2)
  19.     { cout<<endl;
  20.     }
  21.     Sleep(1000);
  22.  
  23.     cantI=i*impulso;
  24.     S1=false;
  25.  
  26. }
  27.  
  28. void mostrar()
  29. {
  30.     S2=true;
  31.     turno=1;
  32.     while(S1==true && turno==1)
  33.     {
  34.         cout<<endl;
  35.     }
  36.     Sleep(1000);
  37.     Ckw=cantI/3200;
  38.     cantCkw+=Ckw;
  39.     cout<<"Se acumulo "<<cantI<<" impulsos en total"<<endl;
  40.     cout<<"Se contabilizo "<<cantCkw<<" Kilowats"<<endl;
  41.     S2=false;
  42. }
  43.  
  44. int main()
  45. {
  46.     int aux;
  47. cout<<"\t============\n"; cout<<endl;
  48. cout<<"Ingrese hora : ";
  49. cin>>h;
  50. cout<<endl;
  51.  
  52. for(i=1; i<=h; i++)
  53.     {
  54.     Sleep(4000);
  55.     cout<<"\nAcaba de pasar "<<i<<" hora(s)  "<<endl;
  56.  
  57.     acumulador();
  58.     mostrar();
  59. }
  60. getch();
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement