Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite0
Having trouble swapping values in C++
#include <iostream> using namespace std; int main() { int a = 5; int b = 9; cout << "a: " << a << endl; cout <<"b: " <<b; return 0; }
1 Réponse
+ 5
Just use std::swap(a, b) to swap the values of a and b