Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

user takes 6 values if first 3values are equal then swapping

+1 vote
asked Nov 22, 2018 by Ahsan Alvi (130 points)

2 Answers

0 votes
answered Nov 23, 2018 by HASSAN ABID
#include<iostream>

using namespace std;

int main()

{

int a,b,c,d,e,f,swap;

cout<<"Enter first NO here: ";

cin>>a;

cout<<"Enter second NO here: ";

cin>>b;

cout<<"Enter third NO here: ";

cin>>c;

cout<<"Enter fourth NO here: ";

cin>>d;

cout<<"Enter fifth NO here: ";

cin>>e;

cout<<"Enter sixth NO here: ";

cin>>f;

if(a==b && a==c){

     a=d;

     b=e;

     c=f;

     cout<<"First three values are mached an swaped. \n" ;

     cout<<"Now the first value is: "<<a;

     cout<<"\n Now the second value is: "<<b;

     cout<<"\n Now the third value is: "<<c;}

else

     cout<<"First three values are not matched.";

return 0;

}
0 votes
answered Nov 27, 2018 by neha hephzibah
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,d,e,f,temp;
 cout<<"ENTER THE NUMBERS IN ORDER"<<endl;
 cin>>a>>b>>c>>d>>e>>f;
 if(a==b && b==c)
 {
  temp=a;
  a=d;
  c=e;
  d=temp;
  e=f;
  f=temp;
 cout<<"THE INPUTS ARE"<<endl;
 cout<<a<<b<<c<<d<<e<<f<<endl;
 }
 else
  cout<<"success"<<endl;
    return 0;
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...