Question: #include using namespace std; int F(int x[], int c) { if (c < 3) return 0; return x[c - 1] + F(x, c - 1);
#include
int F(int x[], int c) { if (c < 3) return 0; return x[c - 1] + F(x, c - 1); }
int G(int a, int &b) { b = b - a; a = b + a; return a; }
int main() { int a = 4, b = 1; int x[5] = {3, 1, 4, 1, 5}; string s = "Problem Number 2"; cout << x[2 + 2] + x[2] << endl; // line (a) cout << s.substr(2, 3) << endl; // line (b) cout << s.substr(s.find("b")) << endl; // line (c) cout << G(b, a); cout << a << b << endl; // line (d) cout << F(x, 5) << endl; // line (e) return 0; }
Can you please tell me the output of each line and explain to me why in simplest way? I am still a learner, Thank you very much!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
