I am new to computer science and I have doubts :
Doubt 1: If I want the SAME program run 10 times , then would I have to compile the same program 10 times or would I compile the program once and run it 10 times.
Obviously I would compile the program once and run if it is my first time (to look for errors) , but is it necessary to compile and then run for the next times I would be running the program (assuming I am not making any changes to the program )?
Doubt2:
Suppose I have a user input program to find if a number "n" is odd or even .
The user input is std::cin>>n ;
My doubt is if the program would compile for every user input (i.e for every change of the variable n
)?
if yes , then it would be a waste of time because the compiler would have to iterate through the entire library and code , but the only change we have done would be changing the value of the variable n
.
(How would I solve the above problem if it had been the case)?