Question

Assuming the following code is part of an error-free program, what is the output on the screen vector<char> example(4,a); example[2]=b; example.at(1)-c; for (int i-0; I <example.size); i++) cout << examplelil<<

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

Your Code #include #include くiostream» <vector> 3 using namespace std; 4 5 int main) f vector<char> example (4, a); example[2]-b; example.at 1)-c for(int i-0;i<example.sizei++) 10 cout<<example[] 12 13 14 Interactive mode D OFF Focus View: D OFF Version GCC 8.1.0 CommandLine Arguments Stdin Inputs O Execute SaveMy Projects Recent Collaborate FAQ More Options Result... CPU Tine: 8.00 sec(s), Memory: 3144 kilobyte(s) compiled and executed in 1.588 sec(s) a cb a Activate Windows Go to PC settings to activate Windows.

First all the values will have a . But at 2nd position it is replaced by b and first position by c.

So The OUTPUT is:

a c b a

Happy learning

Add a comment
Know the answer?
Add Answer to:
Assuming the following code is part of an error-free program, what is the output on the...
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
  • [10pts] 7) What is the output of the following program? In other words, what is printed...

    [10pts] 7) What is the output of the following program? In other words, what is printed to the screen when you run it? #include <iostream> #include <queue> using namespace std int main) char qu[5] ('a, 'b',c'd','e' queue <char> q int N = 4; char ch for(int í - 0:ì < 5;++1) q.push(qu (]) for (int ǐ 0;i < N;++i) { = ch q.front); q push(ch): q.pop while(!q.emptyO) f cout << q.front ) <<endl; q.pop )

  • Consider the following C++code snippet and what is the output of this program? # include<iostream> using...

    Consider the following C++code snippet and what is the output of this program? # include<iostream> using namespace std; void arraySome (int[), int, int); int main () const int arraysize = 10; int a[arraysize]-1,2,3,4,5, 6,7,8,9,10 cout << "The values in the array are:" << endl; arraySome (a, 0, arraySize) cout<< endl; system ("pause") return 0; void arraySome (int b[], int current, int size) if (current< size) arraySome (b, current+1, size); cout << b[current] <<""; a) Print the array values b) Double...

  • Question 28 What is the output of the following program? Assume code is correct. #include <iostream>...

    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

  • Example (4) Trace the following program and find the output >> SOURCE CODE #include <iostream.h> int...

    Example (4) Trace the following program and find the output >> SOURCE CODE #include <iostream.h> int main0 // define two integers int x-3; int y = 4; //print out a message telling which is bigger if (x >y) i cout << "x is bigger than y" << endl: else cout << "x is smaller than y" << endl; return 0; Example (5) Write a C++ program that takes from the user a number in SR (Saudi Riyal) then the program...

  • 5. What is the output of the following section of a program int a[10] = {2,5,1,6,x,7,0,3,y,8};       ...

    5. What is the output of the following section of a program int a[10] = {2,5,1,6,x,7,0,3,y,8};        for(int i=0;i<9;i++)      a[i]=a[i+1]; for(int i=0;i<8;i++)      cout<<a[i]<<” “; cout<<endl; 6. What will be shown on the output screen after following statements are executed? char a[ ]="I have a part time job"; int c=x, i=0 while(a[i]!=’\0’){      if(a[i]==' '){           c++;           cout<<endl;      }      else           cout<<a[i];      i++; } cout<<c<<endl; 7. After following statements are executed, what are the outputs char a[ ]= "Fresno City College";        for (i...

  • Extra Credit: What is the output of the following program? (5 points) #include <iostream> using namespace...

    Extra Credit: What is the output of the following program? (5 points) #include <iostream> using namespace std; int main ( char greetingl6]- ('H', 'e', T, T, 'o', 0'); cout <<"Greeting message: " cout< greeting << endl return 0;

  • a) A pointer is a variable that contains as its value the Ad of another 9.4...

    a) A pointer is a variable that contains as its value the Ad of another 9.4 Complete the output C++ Program Output #include <iostream> using namespace std; Ox10f055070 0x10f055078 char *suits[4] = {"hearts", "diamonds", "spades", "clubs"}; int main() { for (int i=0; i<4; i++){ cout << &suits[i] << endl; cout << endl; return 0; 9.5 Write the exact output Output C++ Program #include <iostream using namespace std; int maino

  • 7. What is the output of the following program? #include <iostream> int f(int n, int &...

    7. What is the output of the following program? #include <iostream> int f(int n, int & v, int * p) { V = *p; v = y + 1; return n+ (*p); int main() { int n = 10; int m = 20; std::cout << fin, n, & m); a. 30. b. 31. c. 41. d. 42. e. An error occurs. 8. What is the output of the following program? Note that both the signature and the body of the...

  • 5. (7 pts) What wil display on the output screen after following program is executed? includeciostream...

    5. (7 pts) What wil display on the output screen after following program is executed? includeciostream using namespace std int b 40 int A function(int a) int main (void) int c 7, b 15 cout<cA function (e) <cendla return 6 int A function (int a) int i cout<<b<<endl; if (a>-0) else return i i-ai i--ai Ans5 6. (7 pts) Show what will appear on the output screen after the following program is executed tincludeciostream> using namespace std; void A function...

  • C++ OBJECT ORIENTED PROGRAMMING 12. What will be the output of the following C++ code? #include...

    C++ OBJECT ORIENTED PROGRAMMING 12. What will be the output of the following C++ code? #include <iostream> #include <vector> using namespace std; int main() { vector<int> myvector; myvector.push_back(78); myvector.push_back(16); myvector.front() += myvector back(); cout << myvector.front() << '\n'; return 0; } a) 78 b) 16 c) 94 d) 86 13. What is the syntax of class template? a) template <paramaters> class declaration b) Template <paramaters> class declaration c) temp <paramaters> class declaration d) Temp <paramaters> class declaration sums the values...

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
ADVERTISEMENT