وبلاگ رسمی علیرضا شهامت در بلاگ اسکای

وبلاگ رسمی علیرضا شهامت در بلاگ اسکای

وبلاگ رسمی علیرضا شهامت در بلاگ اسکای - تأسیس شده در سال 1396
وبلاگ رسمی علیرضا شهامت در بلاگ اسکای

وبلاگ رسمی علیرضا شهامت در بلاگ اسکای

وبلاگ رسمی علیرضا شهامت در بلاگ اسکای - تأسیس شده در سال 1396

کدهای تعویض دو متغیر در سی ++

کدهای تعویض دو متغیر در سی ++  :


https://www.tutorialspoint.com/swap-function-in-cplusplus


https://www.geeksforgeeks.org/swap-in-cpp/








#include <stdio.h>
void SwapValue(int &a, int &b) {
   int t = a;
   a = b;
   b = t;
}
int main() {
   int a, b;
   printf("Enter value of a : ");
   scanf("%d", &a);
   printf("\nEnter value of b : ");
   scanf("%d", &b);
   SwapValue(a, b);
   printf("\nAfter swapping, the values are: a = %d, b = %d", a, b);
   return 0;
}






فقط کدهای تابع swap  :









void SwapValue(int &a, int &b){    int t = a;    a = b;    b = t; }






https://lrsh1396.blogsky.com/category/default-category/computer/Programming/Bank-of-Codes-and-Algorithms