#include <> not needed in cpp.sh?

Hello!
I have a somewhat simple problem. In cpp.sh you only thing you need is...
 
#include <iostream> 


For example...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
//should need <ctime>
//should need <cstdlib>
//should need <string>

int main()
{
    std::string inPutNum; //Users inputed number.
    int outPutNum; //Users outputed number.
    const int MAX_RAND_VALUE = 100; //Maximum randum number limit.
    
    srand(time(NULL)); //unique seed.
    
    std::cout << "I will give you a unique number based off of your"
              << " input of a integer (whole number).\n";
    
    std::cout << "Number: "; //"Asks" for a intager.
    getline(std::cin,inPutNum); // Grabs the number.
    
    outPutNum = stoi(inPutNum); //sets are int to the users input.
    
    if(outPutNum < 1 || outPutNum > 9999) //Keeps a resonable number.
    {
        outPutNum = 1;
    }             
    
    std::cout << outPutNum << " is the number we were able to use.\n" ;
    std::cout << "\n\nRandom Ultra Number (R.U.N): " << (outPutNum * outPutNum)
                 * (((rand() % MAX_RAND_VALUE) + 1) + outPutNum); //*facepalm*
                 
    //notice no return statment!
}


any idea?

P.S My original code! Is it any good?
Last edited on
A particular implementation may #include other headers from a header, so when you #include <iostream>, you might also end up #including <ctime> indirectly. However, your code might not compile in other implementations.
Thanks, I just was curios.
Topic archived. No new replies allowed.