Advertisement
rootuss

kolory

Nov 4th, 2016
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.77 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     HANDLE hOut;
  9. hOut = GetStdHandle( STD_OUTPUT_HANDLE );
  10. SetConsoleTextAttribute( hOut, 10 );
  11.     int i=11, k=10;
  12.     cout<<"Wykonuje petle do while!"<<endl;
  13.     Sleep(2000);
  14.     SetConsoleTextAttribute( hOut, 7 );
  15.     do
  16.     {
  17.         cout<<"i= "<<i<<endl;
  18.         k-=4;
  19.         Sleep(1000);
  20.         cout<<"k= "<<k<<endl;
  21.         i-=3;
  22.         Sleep(1000);
  23.  
  24.     }
  25.     while (i>=3);
  26.     SetConsoleTextAttribute( hOut, 6 );
  27.     cout<<"k-2="<<k-2<<endl;
  28.     SetConsoleTextAttribute( hOut, 7 );
  29.     cout<<"****************************************************************************"<<endl;
  30.     SetConsoleTextAttribute( hOut, 10 );
  31.  cout<<"Wykonuje petle while!"<<endl;
  32.     Sleep(2000);
  33.     SetConsoleTextAttribute( hOut, 7 );
  34.     i=11;
  35.     k=10;
  36.         while (i>=3)
  37.         {
  38.         cout<<"i= "<<i<<endl;
  39.         k-=4;
  40.         Sleep(1000);
  41.         cout<<"k= "<<k<<endl;
  42.         i-=3;
  43.         Sleep(1000);
  44.         }
  45.         SetConsoleTextAttribute( hOut, 6 );
  46.     cout<<"k-2="<<k-2<<endl;
  47.     SetConsoleTextAttribute( hOut, 7 );
  48.      cout<<"****************************************************************************"<<endl;
  49.      SetConsoleTextAttribute( hOut, 10 );
  50.      cout<<"Wykonuje petle for!"<<endl;
  51.     Sleep(2000);
  52. SetConsoleTextAttribute( hOut, 7 );
  53.     k=10;
  54.      for (i=11;i>=3;i-=3)
  55.      {
  56.        cout<<"i= "<<i<<endl;
  57.         k-=4;
  58.         Sleep(1000);
  59.         cout<<"k= "<<k<<endl;
  60.         i-=3;
  61.         Sleep(1000);
  62.      }
  63.      SetConsoleTextAttribute( hOut, 6 );
  64.      cout<<"k-2="<<k-2<<endl;
  65.      SetConsoleTextAttribute( hOut, 7 );
  66.      cout<<"****************************************************************************"<<endl;
  67.  
  68.     return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement