Tuesday, November 16, 2021

Text Color and Sleep in Dev C++

 A simple program to demonstrate how to use text color and sleep in Dev C++. I hope you will find my work useful.

Machine Problem in C++

Create a program that will print your  name "Jake" with a delay of 1 second. 

Color should be in alternate. (blue,red,green and yellow) using Dev C++.

blue - 1

red - 4

green - 2

yellow - 6


 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Program Listing

/* demo.cpp

   Jake Rodriguez Pomperada, MAED-IT, MIT

   www.jakerpomperada.blogspot.com and www.jakerpomperada.com

   jakerpomperada@gmail.com

   Bacolod City, Negros Occidental Philippines.

*/


#include <iostream>

#include <windows.h>

#include <conio.h>


using namespace std;


int main()

{

        HANDLE color=GetStdHandle(STD_OUTPUT_HANDLE); //just once

       

        // Text Color and Sleep in Dev C++

        while(!kbhit())

{

        cout << "  ";

         SetConsoleTextAttribute(color, 1);

cout<<"J";

        Sleep(1000);

        SetConsoleTextAttribute(color, 4);

        cout<<"a";

         Sleep(1000);

        SetConsoleTextAttribute(color,2);

        cout<<"k";

        Sleep(1000);

        SetConsoleTextAttribute(color, 6);

        cout<<"e";

}

       return 0;

}



No comments:

Post a Comment