Assalamu'alaikum,,,,
alhamdulillah pada pertemuan kali ini kami telah membahas bebrbagai kasus tentang pengkondisian....
berikut adalah hasil dari pembahasan kami, semoga bermanfaat!!
Flowchart dan program Kasus 3.1 (nilai max dari 2 bilangan)
#include <iostream>
#include <string>
using namespace std;
int main()
{
float a,b;
cout<<"bil.1 = ";
cin>>a;
cout<<"bil.2 = ";
cin>>b;
if(a>b){
cout<<"bilangan terbesar = "<<a<<endl;
}
else {
cout<<"bilangan terbesar = "<<b<<endl;
}
system("pause");
return 0;
}
flowchart dan program kasus 3.2 (bilangan terbesar dari 3 buah bilangan)
#include <iostream>
#include <string>
using namespace std;
int main()
{
string raptor_prompt_variable_zzyz;
float z;
float x;
float y;
raptor_prompt_variable_zzyz ="bil.1 = ";
cout << raptor_prompt_variable_zzyz;
cin >> x;
raptor_prompt_variable_zzyz ="bil.2 = ";
cout << raptor_prompt_variable_zzyz;
cin >> y;
raptor_prompt_variable_zzyz ="bil.3 = ";
cout << raptor_prompt_variable_zzyz;
cin >> z;
if (x>y)
{
cout << "bilangan terbesar = "<<x << endl; }
else
{
if (y>z)
{
cout << "bilangan terbesar = "<<y << endl; }
else
{
cout << "bilangan terbesar = "<<z << endl; }
}
system("pause");
return 0;
}
#include <string>
using namespace std;
int main()
{
string raptor_prompt_variable_zzyz;
float z;
float x;
float y;
raptor_prompt_variable_zzyz ="bil.1 = ";
cout << raptor_prompt_variable_zzyz;
cin >> x;
raptor_prompt_variable_zzyz ="bil.2 = ";
cout << raptor_prompt_variable_zzyz;
cin >> y;
raptor_prompt_variable_zzyz ="bil.3 = ";
cout << raptor_prompt_variable_zzyz;
cin >> z;
if (x>y)
{
cout << "bilangan terbesar = "<<x << endl; }
else
{
if (y>z)
{
cout << "bilangan terbesar = "<<y << endl; }
else
{
cout << "bilangan terbesar = "<<z << endl; }
}
system("pause");
return 0;
}
Tidak ada komentar:
Posting Komentar