--> menukar bilangan dari C ke D,D ke C
DEKLARASI:
--> C dan D sebagai bahan input
--> E dan F sebagai tempat penyimpanan (save)
SOLUSI:
C=E
C=D
D=E
C++ :
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int garis(int c)
{int d;
for(d=1;d<c;d++)
cout<<endl;
return d;
}
int main(int argc, char** argv) {
int c,d,e;
garis(1);
cout<<" MENUKAR DUA VARIABEL BERBEDA"<<endl<<endl;
garis(1);
cout<<"masukan nilai C : ";
cin>>c;
cout<<"masukan nilai D : ";
cin>>d;
e=d;
d=c;
c=e;
cout<<endl;
cout<<"NILAI C di ubah menjadi : "<<c<<endl;
cout<<"NIALI D di ubah menjadi : "<<d<<endl;
garis(1);
return 0;
}
RAPTOR NYA menggunakan variabel A dan B untuk mempermudah :D
SEMOGA BERMANFAAT :D !!!
Tidak ada komentar:
Posting Komentar