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

Source: Internet
Author: User

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.