(a) Function int g(int n){} returns the sum of all integers from 0 to n-1 (both inclusive)
(b) 1
(c) Yes
(d) Number: 12
Enter data
You have 0.2
(a)
(b)
(d)
(a) Consider the following C++ function: 1 int g(int n) { 2 if (n == 0)...
16 Points) Question 3 Write down the outputs of the following program into the provided table include <iostream> using namespace std; void fun I(int a); int fun2(int a, int b); int x-3: int main) int x-1,y 0,z-2; x-fun2(y,z); cout sx fun 1 (z); cout (#xtytz(endl; y-fun2(x,x); cout <exty+zscendl; system("pause"); void fun 1 (int a) int fun2(int a, int b) int static c2; return atx; 16 Points) Question 3 Write down the outputs of the following program into the provided table...
C++ 1. A?B?C?D? which one is correct 2. 3A, 3B #include<iostream> using namespace std; void swap0(int* ptri, int* ptr2) { int *temp; temp = ptr1; ptr1 = ptr2; ptr2 = temp; void swap1(int ptri, int ptr2){ int temp; temp = ptri; ptr1 = ptr2; ptr2 = temp; portion void swap2(int *&ptri, int *&ptr2){ int* temp; temp = ptr1; ptr1 = ptr2; ptr2 = temp; void swap3(int &ptri, int &ptr2) { int temp; temp = ptr1; ptr1 = ptr2; ptr2 =...
Problem 1. Select the running time of each function. void print_array (int* A, int n) for (int í 0; i < n; ++i) cout << A[i] << endl; void print_array pairs (int* A, int n) for (inti 0; i < n; ++i) for (int j 0; j < n; ++j) cout << Ai] ALj]< endl; void print_array_start(int* A, int n) for (int i 0; i < 100 ; ++i) cout << A[i] << endl; void print_array_alt (int* A, int n)...
c++ #include using namespace std; int main() { int n, x, num, j = 0; cin >> n >> x; int*arr = new int[n]; for (int i = 0; i < n; i++) { cin >> num; if (num < x) { arr[j] = num; j++; } } for (int i = 0; i < j; i++) {...
Trace the following program and display the exact outpust #incl udeci ostream» using namespace std const int siz-10 int ffx(Float ati,Float b(l, int s): bool ifp(int n) int mainO loat arysiz]-(6,19,5,3,2,17,40,90,19,80) float ary2tsiz)-to int i,x x-ffx(aryl,ary2, ,siz): cout<<"n The values are: for(1-0:1<" ; it) ary2[i] ; cout<<" coutくくendl ; return 0; oerio int ffx(float all,float bll, int S) int i,p-0; for(i 0: i<s ; i++){ )// end for LD++]=a[i]; return p; if(ifp(ali])) bool ifp(int n)l bool ans-true for (i=2:ic, itt)...
what is the output for the following code? explain the steps. /*#include <iostream> using namespace std; int f(int &i) { i = 10; return(5 * i); } int main() { int n = 5; f(n); cout << n << "\n"; return 0; } #include <iostream> using namespace std; int sub1(int n) { n--; return n; } int main() { int m = 10; for(int j = 0; j < 10; j++) m -= sub1(j); cout << m << "\n"; return...
Question 28 What is the output of the following program? Assume code is correct. #include <iostream> using namespace std; int main() { int i = 1,j,x = 5, y = 4; while (i <= y) { for (j = 0; j <= y2; j++) cout << 'Z'; cout << endl; i=i+1; } return 0; 3 B IV AA-I E333 X X, B, GT 12pt Paragraph
81. The following function call doesn’t agree with its prototype: cout << BoxVolume( 10, 5 ); int BoxVolume(int length = {1}, int width = {1}, int height = {1}); T__ F__ 82. The following function is implemented to swap in memory the argument-values passed to it: void swap(int a, int b) { int temp; temp = a; a = b; b = temp; ...
What is the final value of x in memory after the code below is run? 1 int x; 2 for (x=0; x<5; x++){ 3 4} Answer: Answer What is the result of the following bitwise operation in decimal? ((~6)&36)|(6)&(~36)), where ~, |, and & are the bitwise NOT, OR, and AND respectively. Answer: Answer Complete the attempt to allocate a 5-element array of pointers to doubles and initialise the associated double value to 0.0. double* a[10]; for (int j =...
C++ Language I have a class named movie which allows a movie object to take the name, movie and rating of a movie that the user inputs. Everything works fine but when the user enters a space in the movie's name, the next function that is called loops infinetly. I can't find the source of the problem. Down below are my .cpp and .h file for the program. #include <iostream> #include "movie.h" using namespace std; movie::movie() { movieName = "Not...