Question

Language is C++ int main() { int a, b, c;        // int data type for simple...

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?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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)
}

Add a comment
Know the answer?
Add Answer to:
Language is C++ int main() { int a, b, c;        // int data type for simple...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Translate the following C program to Pep/9 assembly language. #include <stdio.h> int main() {     int...

    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...

    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='...

    #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...

    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

  • In "C" Language (Using Unions) Create union integer with members char c, short s, int i and long b. Write a program th...

    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...

  • How can I express this C language code "loops" to MIPS language program. Thank you int main() { ...

    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--; }

  • #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 =...

    #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,...

    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...

  • int main() { int a =100, b=200, c; c= a( !=100 || b>200); printf("c=%d", c); return...

    int main() { int a =100, b=200, c; c= a( !=100 || b>200); printf("c=%d", c); return 0; } ---------------------------------------- so here what i have understood so far is (not sure Its right or wrong) (100! =100 || 200>200) 0||0 if 0||0; isnt it 1? why the answer is 0? and if (1) 0&&0 (2) 0&&1 (3) 1&&0 (4) 0||1 (5) 1||0 please answer these five cases as well. thank you in advance

  • C++ What output does the following program produce? int getValue(int a, int b, int n); int...

    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...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT