Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- using namespace std;
- int main()
- {
- HANDLE hOut;
- hOut = GetStdHandle( STD_OUTPUT_HANDLE );
- SetConsoleTextAttribute( hOut, 10 );
- int i=11, k=10;
- cout<<"Wykonuje petle do while!"<<endl;
- Sleep(2000);
- SetConsoleTextAttribute( hOut, 7 );
- do
- {
- cout<<"i= "<<i<<endl;
- k-=4;
- Sleep(1000);
- cout<<"k= "<<k<<endl;
- i-=3;
- Sleep(1000);
- }
- while (i>=3);
- SetConsoleTextAttribute( hOut, 6 );
- cout<<"k-2="<<k-2<<endl;
- SetConsoleTextAttribute( hOut, 7 );
- cout<<"****************************************************************************"<<endl;
- SetConsoleTextAttribute( hOut, 10 );
- cout<<"Wykonuje petle while!"<<endl;
- Sleep(2000);
- SetConsoleTextAttribute( hOut, 7 );
- i=11;
- k=10;
- while (i>=3)
- {
- cout<<"i= "<<i<<endl;
- k-=4;
- Sleep(1000);
- cout<<"k= "<<k<<endl;
- i-=3;
- Sleep(1000);
- }
- SetConsoleTextAttribute( hOut, 6 );
- cout<<"k-2="<<k-2<<endl;
- SetConsoleTextAttribute( hOut, 7 );
- cout<<"****************************************************************************"<<endl;
- SetConsoleTextAttribute( hOut, 10 );
- cout<<"Wykonuje petle for!"<<endl;
- Sleep(2000);
- SetConsoleTextAttribute( hOut, 7 );
- k=10;
- for (i=11;i>=3;i-=3)
- {
- cout<<"i= "<<i<<endl;
- k-=4;
- Sleep(1000);
- cout<<"k= "<<k<<endl;
- i-=3;
- Sleep(1000);
- }
- SetConsoleTextAttribute( hOut, 6 );
- cout<<"k-2="<<k-2<<endl;
- SetConsoleTextAttribute( hOut, 7 );
- cout<<"****************************************************************************"<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement