Follow us on FB

Sunday, March 2, 2014

how to create time delay in C++

Time delay in C++ means :
                                     Which you enter or gives input using Turbo C++  or dev , after compiling shows result as :
             
             Print Single letter then delay of few seconds and again show next letter of the word .
              The Uper Step do again and again till the string or pragraph end.
This is Very Simple and Easy mathod to create a time delay in C++ .
Every Step is explaned completely below .
Advantage :
There are few advantage of creating time delay in C++ as :
You can create introduction view in a uniqe style .

Creating game this is a very charming look .
After compiling print your result slow .
And many others .....................

Code of the Program :

#include <iostream>
#include <conio.h>
#include <string.h>
using namespace std;

void mydelay(int sec)            // Defining Delay Function
{
     int w,e;
     for(w=0; w<sec; w++)    // Making Nested Loop for More Time Consuming
     {
              for(e=0; e<1000000; e++)  // 1000000 for making time(printing) speed slow
              {
              }
     }
 }

int main()       // for Turbo Cplus plus write "void main( )"
{
   
    char name[]= "My Name is Haseeb Jaffur....";
    char web[] = "www.placeoflearn.blogspot.com and www.greatmasti4u.blogspot.com";
    int t=0;
    int get = strlen(name); // taking Length of String using "strlen( )" function
    int ln=strlen(web);
    cout << endl;
    cout<<"\n\t";
    while(t!=get)
    {                  
                        mydelay(55);
                        cout << name[t];
                        t++;
           }
           cout<<"\n\t";
           int i=0;
           while(i!=ln)
    {                  
                        mydelay(45);  // 45 will be passed to sec variable
                        cout << web[i];
                        i++;
           }
           cout<<endl;
    cin.get();           
    return 0;
}
// for implementing it in T.C remove 4th and  last line
                                                 // THANKS For Visiting ...
                                                  // by Haseeb Jaffur


If you face any Problem show in comment , i am try my best to resolve this problem .......

Unknown

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.

0 comments:

Post a Comment

 

Copyright @ 2013 placeoflearn.