12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- //
- // Created by logicp on 4/22/17.
- //
- #include <stdio.h>
- #include <iostream>
- #include <ctime>
- #include <limits>
- #include "drone.h"
- using namespace std;
- drone::drone() {}
- drone::drone(int payload) {
- payload = payload;
- }
- void drone::self_destruct(bool explosives) {
- std::cout << "Self destruct timer initiated";
- }
- void drone::set_location(float longitude, float latitude) {
- std::cout << "Location set to " << longitude << std::endl << "Latitude set to " << latitude << std::endl;
- }
- int drone::explore(int explore_time) {
- int xRan;
- int distance_travelled;
- srand( time(0)); // This will ensure a really randomized number by help of time.
- xRan=rand()%9+1;
- distance_travelled = explore_time * xRan;
- return distance_travelled;
- // std::time_t startTime = std::time(nullptr);
- //
- // std::time_t currentTime;
- // double seconds;
- //
- // std::cout << "Input explore duration for drone mission: " << std::endl;
- // std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
- // std::time(¤tTime); //get the time now that the user has entered something and stick it in currentTime
- //
- // seconds = std::difftime(currentTime, startTime);
- // std::cout << "It took you " << seconds << " seconds to enter something.\n";
- //
- // std::cout << "Input something else...";
- // std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
- // std::time(¤tTime);
- //
- // seconds = std::difftime(currentTime, startTime);
- // std::cout << "It has now been " << seconds << " since you were asked to input something\n";
- return 69;
- }
|