Con trỏ cơ ban part 8 (hoán đổi 2 biến bằng con trỏ)

#include<iostream> using namespace std; #include<conio.h> void hoanvi(int *a,int *b) { int t=*a; *a=*b; *b=t; } int main() { int *x= new int ; int *y=new int ; cout<<"nhap so thu nhat ";cin>>*x; cout<<"nhap so thu hai ";cin>>*y; hoanvi(x,y); cout<<"hoan vi 2 so la:"<<*x<<" "<<*y; delete x; delete y; getch(); return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.