Language is C++
int main()
{
int a, b, c; // int data type for simple math
a = 9;
c = a + 1 + 1 * 0;
b = c++;
return 0; // return main int as Exit Status 0 (success)
}
What are the final values of the variables a, b, and c?
ANSWER:-
The final value of a,b and c will be
a = 9 b = 10 c = 11
#include <iostream>
using namespace std;
int main() {
int a, b, c; // int data type for simple math
a = 9;
c = a + 1 + 1 * 0;
b = c++;
cout<<"a = "<<a<<endl;
cout<<"b = "<<b<<endl;
cout<<"c = "<<c<<endl;
return 0; // return main int as Exit Status 0
(success)
}
Language is C++ int main() { int a, b, c; // int data type for simple...
Translate the following C program to Pep/9 assembly language. #include <stdio.h> int main() { int number; scanf("%d", &number); if (number % 2 == 0) { printf("Even\n"); } else { printf("Odd\n"); } return 0; }
Consider the following C++ program: #include <iostream> #include <cstdlib> using namespace std; int main int n =0; int i = 0; cout << "Please enter a strictly positive number:"; cin >> n if (n <= 0) exit(EXIT_FAILURE) while (n > 1) n-n/2; i << endl; cout"Output:" return 0; Answer the following questions: What is the output of the program for each of the following values of n: -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9? What does...
#include <stdio.h> int main(int argc, char *argv[]) { char a, *pc, c[9]; int i, *pk, k[9]; a='z'; pc=&(c[8]); pk=&(k[0]); for (i=0; i<9; i++) { *pc=a-(char)i; pc--; *pk=(int)a-i; pk++; } return 0; }//end of main Answer the below questions with the above code Write out the memory map for the above C code in the following table. For array variables, list the address range for the entire array. Assume the memory address starts from 100, that is, the address for a...
MIPS assembly language Covert this code to MIPS: #include <stdio.h> int function (int a) int main)i int x=5 ; int y: y function(x); printf "yd",y); return 0; int function (int a) return 3*a+5; Assumptions: . Place arguments in $a0-$a3 . Place return values in $vO-$v1 Return address saved automatically in $ra . lgnore the stack for this example. (Thus, the function will destroy registers used by calling function
How can I express this C language code "loops" to MIPS language program. Thank you int main() { int Z=2; int i; i=0; while(1){ if(i>20) break; Z++; i+=2; } do { Z++; } while (Z<100); while(i > 0) { Z--; i--; }
In "C" Language (Using Unions) Create union integer with members char c, short s, int i and long b. Write a program that inputs values of type char, short, int and long and stores the values in union variables of type union integer. Each union variable should be printed as a char, a short, an int and a long. Do the values always print correctly:? Sample input/output. To print in hexadecimal, use %x as the formatter. Input must be same...
#include<stdio.h> int f(int a,int b); int main(){ int a=8, b=4,c=2; b = f(c,a); printf("a=%d,b=%d\n,a,b,c); c = f(a+3,b-2); printf("a=%d,b=%d,c=%d\n",a,b,c); return 0; } int f(int a, int b){ a=b+6 b=a-2 printf("a=%d,b=%d\n",a,b); return a+b; } what is the first line of output produced? what is the second line of output? what is the third line if output? what is the forth line of output? if there is problems ill post the choices thank you
Problem H1 (Using C++) In the main function, define four variables of type int, named: first, second, third, and total. Write a function named getData that asks the user to input three integers and stores them in the variables first, second, and third which are in the main function. Write a function named computeTotal that computes and returns the total of three integers. Write a function named printAll that prints all the values in the format shown in the following...
Translate the following C program to Pep/9 assembly language. #include <stdio.h> const int limit = 5; int main() { int number; scanf("%d",&number); while (number < limit){ number++; printf("%d",number); } return 0; }
C++ What output does the following program produce? int getValue(int a, int b, int n); int main() cout << getValue(1, 7, 7) << endl; return 0; } // end main int getValue(int a, int b, int n) int returnValue = 0; cout << "Enter: a = " < a << " b = " << b << endl; int c = (a + b)/2; if (C* C <= n) return value = c; else returnValue = getValue(a, C-1, n); cout...