Advertisement
koodeta

UseCar.cpp

Apr 29th, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "Car.h"
  3. #include "Car.cpp"
  4. #include <stdio.h>
  5. #include <string>
  6. #include <iostream>
  7.  
  8. using namespace std;
  9.  
  10. int main(){
  11.  
  12.     Car dealer;// Creates a new Car object
  13.     int yearModel;// Local variables for model year
  14.     int speed;// Local variables for speed
  15.     string make;// Names are kept the same to avoid confusion
  16.  
  17.     // Calls the accelerate function 5 times and displays the results after each iteration
  18.     for (int i = 0; i < 5; ++i){
  19.         dealer.accelerate(speed);
  20.         cout << "The current speed is: " << dealer.getSpeed() << endl;
  21.  
  22.     }
  23.  
  24.     cout << "We are now braking the car" << endl;
  25.  
  26.     // Calls the brake function 5 times and displays the results after each iteration
  27.     for (int i = 0; i < 5; ++i){
  28.         dealer.brake(speed);
  29.         cout << "The current speed is: " << dealer.getSpeed() << endl;
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement