First of all thanks for answering and helping out...
Now i was making a program to let the user enter any number... and then use the program to point out the total number of 4's in the the number entered and i have now encountered a problem..
This is my first post here so please excuse me if i make any mistakes..
The Code
int main()
{
    int T,i,j,l;
    char N,p[10];
    cin>>T;
    while(T--)   //The number of times a user can enter a new number
    {
        cout<<"\nEnter Numbers\n";
        l=0;i=0;
        do
        {
            N=getch();  //getch is used so that the enter key need not be pressed and the 
                        //number looks like a whole and also so the each number is 
                        //individually stored  
            p[i]=N;    //here the number entered is stored in p
            cout<<N;  //to display the number obviously
            l++;i++;
        }while(N!=' ');  //Now here between '' something has to be present so that the loop 
                         //terminates as soon as the enter key is pressed right now as soon 
                         //as the spacebar is hit the loop will terminate. 
        cout<<"\n";
        j=0;
        for(i=0;i<l;i++)  //using l so that the loop runs accordingly
        {
            if(p[i]=='4') 
            {
                j++;    //for couting the number of 4's
            }
            cout<<p[i]<<"\n";   //wont be needing in the final program but here cout is just
                               // to check the output
        }
        cout<<"\n THERE ARE "<<j<<" FOURS\n";
    }
}
Please not that i already have a solution for my program so please DO NOT  provide a different code using some different logic... i really need this very same program to work.i know that this program can be made to work using string length but here i want the loop to terminate after the enter key is pressed.
 
     
     
    