Permasalahan
Buatlah sebuah program dinamis untuk memasukkan nilai apa saja dana membalikkan nilai tersebut dengan variabel selanjutnya dengan menggunakan pemrograman bahasa c++
Source code
#include <iostream>
#include <stdlib>
int main(){
int a,b,c,d,e,x;
cout<<"a = ";cin>>a;
cout<<"b = ";cin>>b;
cout<<"c = ";cin>>c;
cout<<"d = ";cin>>d;
cout<<"e = ";cin>>e;
x=a;
a=b;
b=c;
c=d;
d=e;
e=x;
cout<<"========================"<<endl;
cout<<"a = "<<a<<endl;
cout<<"b = "<<b<<endl;
cout<<"c = "<<c<<endl;
cout<<"d = "<<d<<endl;
cout<<"e = "<<e<<endl;
system("pause");
}
#include <stdlib>
int main(){
int a,b,c,d,e,x;
cout<<"a = ";cin>>a;
cout<<"b = ";cin>>b;
cout<<"c = ";cin>>c;
cout<<"d = ";cin>>d;
cout<<"e = ";cin>>e;
x=a;
a=b;
b=c;
c=d;
d=e;
e=x;
cout<<"========================"<<endl;
cout<<"a = "<<a<<endl;
cout<<"b = "<<b<<endl;
cout<<"c = "<<c<<endl;
cout<<"d = "<<d<<endl;
cout<<"e = "<<e<<endl;
system("pause");
}
Hasil run program
Hasil run program membalikkan nilai |
comment 0 komentar:
more_vertsentiment_satisfied Emoticon