Hey. Ok, I have a program in which the user enters a value and then I call a function which uses that value for a calculation. Code (Text): int xpower(int x) { int n = 3; int power = 1; int i = 0; while (i < n) { power = power * x; i = i + 1; } return power; } So the value the user enters is x and n is the power....so x^n. The equation I must use...n HAS to start at 3. I want to use the function, return the value then increment n by 2, the problem I think I have is that everytime I use the function i basically reset n to 3....so is there any way I can get around this?
DUUUUUUUUUUUUUUUUUUUUUUHHHHHHHH, man I miss the sillyest things :x. I've just seen it myself loool. I took n out of the function, it didn't need to be there at all. I initialised n in the main body and added another parameter in the function. Thanks for looking anyway