Analisis :
Input : misalkan A dan B, keduanya integerAlgoritmanya:
Proses : bandingkan A dan B
Jika A > B maka A terbesar (output)
Sebaliknya B terbesar (output)
Syntax nya :
#include <iostream>
#include <string>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
string raptor_prompt_variable_zzyz;
int a;
int b;
raptor_prompt_variable_zzyz ="Masukkan bilangan pertama";
cout << raptor_prompt_variable_zzyz << endl;
cin >> a;
raptor_prompt_variable_zzyz ="Masukkan bilangan kedua";
cout << raptor_prompt_variable_zzyz << endl;
cin >> b;
if (a>b){
cout <<"b ="<<b<<" bilangan terbesar = "<<a<<endl;
}
else{
cout <<"Kedua bilangan sama besar"<< endl;
}
return 0;
}
Nb: harus di coba gan!!!
Tidak ada komentar:
Posting Komentar