#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2017
    Posts
    85
    Rep Power
    2

    [Dev C++] Random Number not Works, Help Needed!


    Hey C++ Programmers...

    I am learn C++ from scrach and now i am by lession 4, called functions > rand()...
    So this is my script, written in dev c++, windows xp yet:
    Code:
    #include <stdlib.h>
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    	int number = rand();
    	cout << number;
    	return 0;
    }
    It looks like thad the stdlib does'nt works in dev c++... the under posted error (not an compiling error yet,
    but the random number don't are find) yet...

    So this is whats don't works:
    --------------------------------
    Failed to execute "C:\Documents and Settings\Eigenaar\Bureaublad\jamie\Script\Sc
    ript CPP\Rand\Rand1 - Simple.exe":
    Error 127: Kan opgegeven procedure niet vinden.

    Druk op een toets om door te gaan. . .


    Now i translate my error from dutch to englisch:

    Code:
    --------------------------------
    Failed to execute "C: \ Documents and Settings \ Owner \ Desktop \ jamie \ Script \ Sc
    rips CPP \ Rand \ Rand1 - Simple.exe ":
    Error 127: Can not find specified procedure.
    
    Press a key to continue. . .

    Just can anyone tell me whats wrong ?.... i use "Dev C++ 5.x" on windows XP (in this case) and
    at home on windows 10 at the moment....

    I even tryed this to import:
    #include <cstdlib>

    Can anyone help me to fix this problem ?..., Thanks for help, Jamie.






    Edit:

    I think this not worked on Windows XP, or i get an mistake with download Dev C++...
    At home, on my computer i get Windows 10 and there the function rand() works as well....

    Jamie.
    Last edited by JamieVanCadsand; May 3rd, 2018 at 10:54 AM. Reason: Problem fixed on my computer!....
  2. #2
  3. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Posts
    5,974
    Rep Power
    510
    The program works on my linux system. Try replacing for #include<stdlib.h>

    #include <cstdlib>

    Both work on my system.
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2017
    Posts
    85
    Rep Power
    2
    Originally Posted by b49P23TIvg
    The program works on my linux system. Try replacing for #include<stdlib.h>

    #include <cstdlib>

    Both work on my system.
    I think it was an mistake downloading Dev C++, i tryed to doenload Dev C++ againg and i think it works as well,
    on my computer at home, the rand function (rand()) works as well...

    But thanks for our help, Jamie...
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2017
    Posts
    85
    Rep Power
    2
    Oops... with againg i means again... i to day, in the morning i was download Dev C++ again and this works
    for some functions they worked not in my first download on windows XP...

    This problem is fixed, the first download take was an mistake, now i was download Dev C++ again and
    its fixed!....

IMN logo majestic logo threadwatch logo seochat tools logo