Saturday, 9 May 2015

How to Generate Multiple color in Console in C/C++?

       

           //in gcc devc ide
  #include //iostream,conio,windows header file..

  #include
  #include

  int main()
  {  
          int i;
  for(i=0;;i++)

  {
          if(i%2==0)
  {  
      system("color 10");
       Sleep(100);
         system("color 20");
          Sleep(100);
         system("color 30");                     
            Sleep(100);
         system("color 40");
            Sleep(100);
         system("color 50");
            Sleep(100);
         system("color 60");
          Sleep(100);
         system("color 70");
            Sleep(100);
         system("color 80");
            Sleep(100);
         system("color 90");
     }   
     else if(i%6==0)

     {       
                                                   system("color 10");
                                             Sleep(300);
                                             system("color 20");
                                              Sleep(300);
                      system("color 30");
                           Sleep(300);
                                          system("color 40");
                                             Sleep(300);
                                           system("color 50");
                                             Sleep(300);
                                           system("color 60");
                                             Sleep(300);
                                           system("color 70");
                                             Sleep(300);
                                           system("color 80");
                                             Sleep(300);
                                           system("color 90");

       }  
       else
       {   
       system("color 10");
             Sleep(400);
          system("color 20");
          Sleep(400);           
                                                              

                system("color 30");
                           Sleep(400);
                system("color 40");
                           Sleep(400);
                system("color 50");
                     Sleep(400);
                system("color 60");
                      Sleep(400);
                system("color 70");
                     Sleep(400);
                system("color 80");
                           Sleep(400);
                system("color 90");
                         }


     } 


     return 0;


     }


       
 

No comments:

Post a Comment