+ 4

Count Down Timer In C++

How Can I use a count down timer in my code...?!!! Actually i wanna built a simple game in c++ & here is my code... #include <cstdlib> #include <ctime> #include <iostream> using namespace std; int main() { srand((unsigned)time(0)); int x,y,z,a,i; int ar[i]; x=(rand()%100); cout<<"x = "<<x; y=(rand()%100); cout<<"\ny = "<<y; z=x+y; { for (i=1;i<=5;i++) { cout<<"\nEnter Ur Answer = "; cin>>ar[i]; if(z==ar[i]) { cout<<"U R Correct"; exit(0); } else cout<<"U R Wrong"; } } cout<<"\nCorrect answer is (x+y): "<<z; return 0; }

23rd Mar 2018, 2:59 PM
M.N. Sadik
M.N. Sadik - avatar
1 Antwort