You are here:

C++/Launching EXE and Random No


Dear Expert,

Dear Sir i have 2 question to ask you.

1) I am using Visual C++ to develop my program. I want to Lauch EXE Program. what command should i use to launch the EXE program in my Visual C++ coding ? please advise me on this.
2) I want to make a random no between the range of -1 to 1. what command or function should i use ? it is random function ? i need your advise.

thank very much.

Best Regards  

johntim , Thank you for your question.

1. To launch an EXE, use the 'CreateProcess' or 'ShellExecute' functions.

2. There are many different kinds of pseudorandom number generators. It is impossible to generate a truly random number by a computer (unless it has special hardware to do this) because its instruction set is deterministic.

If you are satisfied to have a poorly-distributed pseudorandom number generator, you can use the 'rand' function. If you need a really good one, I can supply code.

David Spector


All Answers

Answers by Expert:

Ask Experts


David Spector


Highly knowledgeable in the C++ language, Visual C++ (MSVC), Windows API, documentation and other quality-assurance techniques, and debugging. Knowledgeable in MFC, COM, GUI design, and object-oriented design.


I have been a software engineer since 1965. I have been published. My specializations have been: biomedical programming, compiler implementation, and many kinds of Windows programming. I don't do Databases or other business-oriented stuff.

Windows?/DOS Developer's Journal, ACM SIGPLAN Notices, and Computer Science Press.

ICCP Systems Programming Certification
Master's degree equivalent in Computer Science

©2016 All rights reserved.