News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Downloading time.h

Started by fs444, June 04, 2017, 12:54:48 AM

Previous topic - Next topic

fs444

When I write
#include <time>
and compile code, I got error
Quotefatal error: time: No such file or directory
Where I can download time.h ?
I use CodeBlocks 16.01 and MinGW.

oBFusCATed

If you want time.h then tell the compiler to include it using #include <time.h>!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

fs444

I have done it already. This is full program code

//casting of a hexahedral bone 6000 times
#include <iostream>
#include <iomanip>
#include <stdlib>
#include <time>

using namespace std;

int main()
{
    const int arraySize = 7;
    int face, frequency[arraySize] = {0};

    srand(time(NULL));

    for (int roll = 1; roll <= 6000; roll++) {
        face = rand() % 6 + 1;
        ++frequency[face];
    }

    cout << "Gran" << setw(17) << "Chastota" << endl;

    for (face = 1; face <= arraySize; face++)
        cout << setw(4) << face
            << setw(17) << frequency[face] << endl;

    return 0;
}

stahta01

Quote from: oBFusCATed on June 04, 2017, 01:30:43 AM
If you want time.h then tell the compiler to include it using #include <time.h>!

"time" is NOT the same as "time.h" that is what oBFusCATed posted.
Please read and fix your code or go to a site the supports programming!

Edit: "time" is also not the same as "ctime".

Read the rules: http://forums.next.codeblocks.org/index.php/topic,9996.0.html

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

fs444

Yes, you right, time.h resolved this problem. Thank you.