Hello I have a question. Why is it that this 2 for statements combines each time I execute it.
Instead of writing 10 "." each, it writes 20 "." instead. Can you guys help me?
I want to execute the program like this:
Enter IP Address:
Enter Port Number:
..........<--delay()
Connected to remote host "<<ip<<" at "<<"port "<<port
Exiting
..........<--delay()
I need the experts help please. Thank you very much!
Code:
void timer();
void connect();
char ip[15];
int port;
main ()
{
cout<<"Enter IP Address: ";
cin>>ip;
cout<<"Enter Port Number: ";
cin>>port;
connect();
timer();
return 0;
}
void connect()
{
cout<<"\nConnected to remote host "<<ip<<" at "<<"port "<<port;
cout<<"\nExiting";
for (int a=0;a<10;a++)
{
printf(".");
Sleep(500);
}
}
void timer()
{
int i;
for( i=0;i<10;i++)
{
printf(".");
Sleep(500);
}
}