0
Follow
0
View

In c++ code, given that m=11,n=41, output m and n to the second, third, and fourth powers.

diexinggui 注册会员
2023-02-28 18:20
<< m*m << endl; cout<<"n的2次方: "< ; cout<< "m的3次方: " << m*m *m<< endl; cout<<"n的3次方: "< ; cout<< "m的4次方: " << m*m *m*m<< endl; cout<<"n的4次方: "< ; return 0; } .
< !- - - - - >
czyroy 注册会员
2023-02-28 18:20
,input[inputid],powinput[powid], pow (input[inputid],powinput[powid])); } } return 0 ; } .
< !- - - - - >
linyu3094 注册会员
2023-02-28 18:20
< div class = "md_content_show e397 data - v - 3967" = "" >

hope to adopt

diaotianming1988 注册会员
2023-02-28 18:20

This is an algorithm, so it looks a little bit more, but it's actually good

c26533806 注册会员
2023-02-28 18:20
,sum); //因为要求每个数据占8列,所以在这里加个\t,为占位空格操作符,为四个空格,这样每打印一个数据空4个字符,两个字符间就有8个了; } } printf ( "\n" ); //因为要求左对齐,所以在两个循环间加个换行操作; sum = 1 ; //这里将sum再次初始化为1 for (i = 1 ; i <= 4 ; i++) //同上,开启计算n次方的循环; { sum = sum * n; if (i == 2 || i == 3 || i == 4 ) { printf ( "%d\t" , sum); } } return 0 ; } .
< !- - - - - >

About the Author

Question Info

Publish Time
2023-02-28 18:20
Update Time
2023-02-28 18:20