Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 6 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 28 Aug 2017 My Price 11.00

end of swap

#include <iostream>

#include <string>

 

using namespace std;

 

void swap(int a, int b)

{

      int temp = a;

      cout<<"a and b have the following values at the start of swap"<<endl;

      cout<<"a = "<<a<<" and b = "<<b<<endl;

      a=b;

      b=temp;

      cout<<"a and b have the following values at the end of swap"<<endl;

      cout<<"a = "<<a<<" and b = "<<b<<endl;

 

}

int main()

{

      int a=111, b=222;

 

      cout<<"a and b have the following values before swap is called"<<endl;

      cout<<"a = "<<a<<" and b = "<<b<<endl;

      swap(a,b);

      cout<<"a and b have the following values after swap is called"<<endl;

      cout<<"a = "<<a<<" and b = "<<b<<endl;

      return 0;

}

 

Question 1:Are the variables a and b used in the function main the same a and b variables that are used in the function swap in the program in Step 1? Explain your answer.

Question 2:Were the values stored in the variables a and b in the function main swapped after the execution of the function swap in the program in Step 1? Explain your observations.

Answers

(5)
Status NEW Posted 28 Aug 2017 12:08 PM My Price 11.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)