Closed roberthsu2003 closed 9 months ago
#include <iostream>
#include <math.h>
using namespace std;
int fun1(int x, int y){
double result = pow(x + y,3);
return result;
}
int main() {
for(int x = 1; x <= 4; x++){
for(int y = 1; y <= 4; y++){
int result = fun1(x,y);
cout << result << endl;
}
}
}
#include <cmath>
#include <iostream>
using namespace std;
int f3(int x, int y);
int main() {
int x, y;
for (x = 1; x <= 4; x++) {
for (y = 1; y <= 4; y++) {
cout << f3(x, y) << endl;
}
}
}
int f3(int x, int y) {
int ans = pow((x + y), 3);
return ans;
}
#include <iostream>
#include <math.h>
using namespace std;
int fun1(int x,int y) {
double result = pow(x,3)+3*pow(x,2)*y +3*x*pow(y,2)+pow(y,3);
return result;
}
int main() {
for (int i = 1; i <= 4; i++) {
for (int j = 1; j <= 4; j++) {
int result =fun1(i,j);
cout << result << endl;
}
}
}
#include <iostream>
#include <math.h>
using namespace std;
int fun1(int x,int y)
{
double result=pow(x, 3)+3*pow(x, 2)*y+3*x*pow(y, 2)+pow(y, 3);
return result;
}
int main() {
for (int i=1; i<=4; i++){
for(int j=1; j<=4; j++){
int result= fun1(i,j);
cout<<result<<endl;
}
}
}
???你的程式碼裡的方程式錯了應該是 double result=pow(x, 3)+3pow(x, 2)y+3xpow(y, 2)+pow(y, 3);缺了運算子 傳送自 Yahoo奇摩電子信箱 Android 版
在 2024 年 1月 月 4 日週四,時間:下午 9:18 , Benjoe1017 @.***> 寫道:
`#include
using namespace std; int fun1(int x,int y) { double result=pow(x, 3)+3pow(x, 2)y+3xpow(y, 2)+pow(y, 3); return result; }
int main() { for (int i=1; i<=4; i++){ for(int j=1; j<=4; j++){ int result= fun1(i,j); cout<<result<<endl; } } } `
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
???你的程式碼裡的方程式錯了應該是 double result=pow(x, 3)+3pow(x, 2)y+3xpow(y, 2)+pow(y, 3);缺了運算子 傳送自 Yahoo奇摩電子信箱 Android 版 在 2024 年 1月 月 4 日週四,時間:下午 9:18 , Benjoe1017 @.> 寫道:
#include #include <math.h> using namespace std; int fun1(int x,int y) { double result=pow(x, 3)+3pow(x, 2)y+3xpow(y, 2)+pow(y, 3); return result; } int main() { for (int i=1; i<=4; i++){ for(int j=1; j<=4; j++){ int result= fun1(i,j); cout<<result<<endl; } } }
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 應該是系統沒更新到,已改為正確的了
#include <iostream>
#include <math.h>
using namespace std;
/*
x = 1, y=1,2,3,4
x = 2, y=1,2,3,4
x = 3, y=1,2,3,4
x = 4, y=1,2,3,4
巢狀迴圈*/
int func2(int x, int y){
double result = pow((x+y) , 3);
return result;
}
int main() {
for (int i = 1; i <= 4; i++){
for(int j = 1; j <= 4; j++){
int result = func2(i,j);
cout << result << endl;
}
}
}
#include <iostream>
#include <math.h>
using namespace std;
int fun(int x,int y)
{
int answer = pow(x,3) + 3 * pow(x,2) * y + 3 * x * pow(y,2) + pow(y,3);
return answer;
}
int main()
{
for(int x=1;x<=4;x++)
{
for(int y=1;y<=4;y++)
{
int answer=fun(x,y);
cout<<answer<<endl;
}
}
return 0;
}