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 Posted / 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 |
Post New Answer View All Answers
Do class declarations end with a semicolon?
What is the use of class in c++?
What is switch case in c++ syntax?
an operation between an integer and real always yeilds a) integer result b) real result c) float result
What is ofstream c++?
Difference between overloading vs. Overriding
What is c++ and its features?
What are the important differences between c++ and java?
Is c or c++ more useful?
How to demonstrate the use of a variable?
How the memory management in vectors are being done. What happens when the heap memory is full, and how do you handle it ?
Do you need a main function in c++?
What do you mean by storage classes?
What is buffering in c++?
What are shallow and deep copy?