0

To Shift the Three Numbers a,b,c in Circular order

Edited by Dani: Promoted to code snippet

#include<stdio.h>
    #include<ctype.h>
    #include<conio.h>
    #include<stdlib.h>
    
    void circular_shift(int &x,int &y,int &z)
    {
    x=x+y;
    y=x-y;
    x=x-y;
    x=x+z;
    z=x-z;
    x=x-z;
    return;
    
    }
    int main()
    {
     int a,b,c;
     a=5;b=8;c=10;
     clrscr();
     printf(" \n %d %d %d ",a,b,c);
     circular_shift(a,b,c);
     printf(" \n %d %d %d ",a,b,c);
     circular_shift(a,b,c);
     printf(" \n %d %d %d " ,a,b,c);
     getch();
     return(0);
    }
2
Contributors
1
Reply
4
Views
5 Years
Discussion Span
Last Post by ScottieF
0
  1. You haven't said what your question is. I can guess that you just want someone to take your source and fix it so that it does your circular shift on the numbers. But it would be nice to hear what you think is wrong first.

  2. Is this supposed to be a C++ problem because you can't pass by reference like how you have in C.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.