Output of the Code is :
Tracing the program:
6) Show the output of the following program. You mus trace the code to show how...
/* • The following code consists of 5 parts. • Find the errors for each part and fix them. • Explain the errors using comments on top of each part. */ #include <stdio.h> #include <string.h> int main( ) { ////////////////////////////////////////////////////////////////////////// ////////////// Part A. (5 points) ////////////////// int g(void) { printf("%s", Inside function g\ n " ); int h(void) { printf(" % s ", Inside function h\ n "); } } printf("Part A: \n "); g(); printf(" \n"); ////////////////////////////////////////////////////////////////////////// ////////////// ...
IV. Function Tracing (20 points) Trace the following program. Show llof your work and the ound he output in the work including labeled boxes for user-defined functions, calculations, and the output in designated spaces. You should draw a box for each variable and show value updates d the output, Show all of your #include <iostream» using namespace std; void mickey (int sa, int b, int &c) void minnie(int u, int &v, int w); void pluto (int m, int n, int...
Show the output of the following program. You must trace the code to show how you reached the answer.
20) What is the output of the following segment of C code: int avg(int n, int* a); int main () { int array[4]={1,0,6,9}; printf("%d", avg(4, array)+ 1); system("pause"); return 0; } int avg(int n, int* a) { int i, sum=0; for (i=0;i<n;i++) { sum+=a[i]; } return sum/n; } a) 16 b) 5 c) 4 d) 8 21) What is the output of the following segment of C code: int x = 2; int y = 3;...
B) The following code is given. Determine the outputs if scoping is static and dynamic. static scope output dynamic scope output #include <stdio.h> void function1(int); void function(int); int function(void); intx=10; main() { functioni(x); function2x); void function1(int y) { int x=y+5; printf("x=%d in function1 \n",function()); void function(int y){ int x=y+10; printf("x=%d in function1 \n", function()); int function(){ return x;
C program take values to 9 and the second can take values to 12 if (x > 2^3) printf("d", x); Int s-e; 21. LOST) Write a statement that declare an array of doubles with two indices, such that the first index can 22 (LOL) The following code will print out: 23. (L02.) The following code will print out: PART 2 Fill in the banks questions 3 marts x + 5; else x -- 2; char "stri - "abcd"; char str2[]...
What will be the value of x printed by the following code (modify_x() function)? #include <stdio.h> void modify_x(void) int x 10; x+ 20 printf("X is : %d\n", x); int main(void) modify_x(); modify_x0: return O; First time:_ Second time: In earlier question (modify_x() function based), what would you do to have different values in the output upon execution of the function each time? HTML Editor
22. (6 points) Determine the output for the following coe # include < stdio.h > int main(void) ( int z 1, total -0, y printf(d , x) ) //end-for printf("The total %d\n", total) ) //end-main
A) Complete the following C program to produce the following output: Output: x = 1, y = 2, z = 3 x = 10, y = 15.000000, z = 4 x = 10, y = 15.000000, z = 50 Program: #include int main(void) { // complete this line printf(" x = %d, y = %d, z = %d \n", x, y, z); { // complete this line // complete this line printf(" x = %d, y = %f, z =...
Convert the C program into a C++ program.Replace all C input/output statements with C++ statements (cin, cout, cin.getline) . Re-make the func function by the following prototype: void func( double, double &); #include int user_interface(); double func(double); void print_table(); int main (int argc, char *argv[]) { print_table(user_interface()); return 0 ; } int user_interface(int val){ int input = 0; printf("This function takes in x and returns an output\n"); printf("Enter Maximum Number of X:"); scanf("%d", &input);...