申論 4以下C++程式有部分違反安全程式設計原則,可能具有許多潛在風險。01#include <iostream>02#include <string>03#define SIZE 1004using namespace std;05class Food {06public:07Food() = default;08Food(int c) { cal = c; }09int getCal() { return cal; }10private:11int cal;12};13void f1() {14Food *f[SIZE];15cout<<f[0]->getCal()<<endl;16}17void f2(int n) {18string *f = NULL;19for(int i = 0; i < n; i++)20f = new string("ok");21cout<<*f<<endl;;22}23void f3(int n) {24double x = 3, y1 = 5, y2 = 2;25for (int i=0; i<n; i++) {26x = x/10.0;27y1 = y1/10.0; y2 = y2/10.0;28}29if(x == (y1-y2)) cout<<"X == Y"<<endl;30}31void f4(char *s1, char *s2) {32int len =0;33char *s =s1 ;34while (*s2!='\0') {35*s1=*s2;36s1++; s2++;37}38cout<<s<<endl;39}40void f5(int n) {41int result = 0;42int *d = new int[n];43d[0] = d[1] = 1;44for(int i = 0; i < n-2; i++) d[i+2] = d[i+1]+d[i];45for(int i = 0; i < n; i++) result = result + d[i];46cout<<result<<endl;47}48int main() {49char s1[]="goodness", s2[]="food";50f1();51f2(2);52f3(1);53f4(s1, s2);54f5(6);55return 0;56}請說明此程式,執行函式f1()~f5()的輸出,以及函式f1()~f5()可能具有的潛在風險。(25分)