Q:

How do I declare a variable in a if-else statement?

I'm still a newbie at this and I really dont understand many things
THE ONLY THING THAT IS MISSING IS x=d/t and I don't know where to put it...
I already tried various methods but still can't figure out where to put it.
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{

     int d, t, s, z;
     cout<<"Enter the distance of your destination:"<<endl;
     cin >>d;
     cout<<"Enter the time you want to get there:"<<endl;
     cin >>t;

     for (z=1; z<=5; z++)
     {
      cout<<"Enter your speed:"<<endl;
      cin>>s;

      if (int x=d/t && x>=s)
      { 

              cout<<"Maintain your speed it is the appopriate speed: "<<s<<"mph"<<endl;
              break;
              }
              else 
              {

              cout<<"Go faster at this rate you won't get to your destination on time"<<endl;
              }
              }
    system("PAUSE");
    return EXIT_SUCCESS;
}

The Output always shows the if statement even though it should already show the else statement.. 
I really need help on this..

A:

This is the code: 
   int main(int argc, char *argv[])

{

 int d, t, s, z;
 cout<<"Enter the distance of your destination:"<<endl;
 cin >>d;
 cout<<"Enter the time you want to get there:"<<endl;
 cin >>t;

 for (z=1; z<=5; z++)
 {
  cout<<"Enter your speed:"<<endl;
  cin>>s;
 int x=d/t;
  if (x>=s)
  { 

          cout<<"Maintain your speed it is the appopriate speed: "<<s<<"mph"<<endl;
          break;
          }
          else 
          {

          cout<<"Go faster at this rate you won't get to your destination on     time"<<endl;
          }
          }
system("PAUSE");
return EXIT_SUCCESS;
       }

