re-coding the code. HLEP!!

hello, i have a long code and i want to re-code it without using <ctime> library. the code is about reading array from file and write it to other file.
i know that <ctime> is to generate random numbers. however, i want it to read from file with my own values knowing that the first 3 numbers (start point), second (target point) and the rest are (obstecles). i'm so sorry the code is too long. the code is working but not the way i want it to.

Last edited on
-
Last edited on
-
Last edited on
-
Last edited on
i'm trying to make it easier. thats why i want some one to help me with it. thank you.
If you want people to take the time and effort to read large amounts of code, you'll want to use code tags to format it properly:

http://www.cplusplus.com/articles/z13hAqkS/
You don't need to use the <ctime> library for generating random numbers. Use the standard way.

Generating 5 random numbers 1 - 100. (obviously pseudo)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <random>
#include <chrono>
#include <functional>

int main()
{
    std::mt19937::result_type seed =
    std::chrono::high_resolution_clock::now().time_since_epoch().count();

    auto get_rand =
    std::bind(std::uniform_int_distribution<int>(1, 100), std::mt19937(seed));

    for (unsigned short int n = 0; n != 5; ++n)
    {
        std::cout << get_rand() << "  " << std::flush;
    }

    std::cin.get();

    return 0;
}
Last edited on
Topic archived. No new replies allowed.