:
Hello every one.
I have described what program has to do and what i have did plz help me.
Program has to take input from the user(i1) and print it, but if the user doesn't give any within 2 seconds program has to print some other variable(i2) ( which is given a default value). For the delay of 2 seconds I have used sleep(2). I am using Linux for coding.
hoping for a early reply.
#include<iostrem>
#include<stdlib.h>
using namespace std;
int main()
{
int i1,i2;
i2=0;
t=0;
cout<<enter the value<<endl;
cin>>i1;
t=1;
sleep(2);
if(t==0)
{
cout<<i1;
}
else
{
cout<<i2;
}
return 0;
}