精華區beta NTUBIME101HW 關於我們 聯絡資訊
#include <iostream> using namespace std; int function(int ); int main() { int i; for(i=1;i<21;i++) cout << "y(" << i << ") = " << function(i) << endl; system("pause"); return 0; } int function(int x) { if(x < 4) return x*x - 1; else if(x >= 4 && x <= 10) return x*x*x - 15*x - 4; else return 8*x*x + 46; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 125.232.106.25