C ++ brush question -- 2713: function --- calculate the power of x to the power of y, set the power of yx to the power of 8x to calculate y
Compile the function POW. The function declaration is as follows:
Int POW (int x, int y); // evaluate the function declaration of the Power y of x
Add the definition of the POW function based on the following programs so that the program can be correctly executed.
/* All rights reserved. * file name: test. cpp * Author: Chen Danni * completion date: January 1, May 22, 2015 * version number: v1.0 */# include <iostream> using namespace std; int POW (int x, int y ); // evaluate the function declaration int main () {int a, B; cin> a> B; cout <a <"<B <" = "; cout <POW (a, B); return 0;} int POW (int x, int y) {int I, s = 1; for (I = 0; I <y; I ++) {s = x * s;} return s ;}
Experience: You need to know why you are struggling, constantly practice small programs, and work hard to get code out of the big program! Continue, go on!