let a,b,c be three integer numbers.write a c++ program
with a function void rotate 1()such that a->b->c and c->a.
Answer / zain
#include <iostream>
using namespace std;
int swap(int,int,int);
int main()
{
int a,b,c;
cout<<" enter 3 number"<<endl;
cin>>a>>b>>c;
swap(a,b,c);
cout<<"in main"<<a<<""<<b<<""<<c<<endl;
return 0;
}
int swap(int i,int j,int w)
{
int t;
t=i;
i=j;
j=w;
w=t;
cout<<"in swap function"<<i<<""<<j<<""<<w<<endl;
return 0;
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Why use of template is better than a base class?
What are literals in C++?
When copy constructor can be used?
What are keywords in c++?
What is pointer in c++ with example?
What is a singleton c++?
What are the advantages and disadvantages of using inline and const?
2 Answers Polaris, TCS, Zimmer Biomet,
Should you pass exceptions by value or by reference?
What is the identity function in c++? How is it useful?
What do you mean by function overriding & function overloading in c++?
How do pointers work?
What are the different data types present in C++?