Problems with functions for c++

Mar 28, 2016 at 11:12pm
We have a problem that asks us to write a void function that uses two nested for loops and the modulus operator to print out prime n integers. The function prototype is primeGen(int n). The only problem I am having is returning the value of i back to the main function can someone help me please?
http://codepad.org/KxutY78T
Mar 29, 2016 at 10:56am
If there is neither a paramter that can hold the result nor a return type you can only store the result in a global variable.
Mar 29, 2016 at 1:06pm
You don't need to return the value. In this problem you are to just print out the numbers. Which you can easily achieve by using the 'printf' or 'cout' command inside the nested loop. If you need further help then PM me.
Topic archived. No new replies allowed.