- flowchart dan program untuk mencari titik tengah garis A(x1,y1) dan B(x2,y2)
#include <iostream>
#include <string>
using namespace std;
int main()
{
float x2,y2,xt,yt,x1,y1;
cout<<"x1 = ";
cin >> x1;
cout<<"x2 = ";
cin >> x2;
cout<<"y1 = ";
cin >> y1;
cout<<"y2 = ";
cin >> y2;
xt =(x1+x2)/2;
yt =(y1+y2)/2;
cout << "titik tengah (a,b) = "<<xt<<","<<yt << endl;
system("pause");
return 0;
}
#include <string>
using namespace std;
int main()
{
float x2,y2,xt,yt,x1,y1;
cout<<"x1 = ";
cin >> x1;
cout<<"x2 = ";
cin >> x2;
cout<<"y1 = ";
cin >> y1;
cout<<"y2 = ";
cin >> y2;
xt =(x1+x2)/2;
yt =(y1+y2)/2;
cout << "titik tengah (a,b) = "<<xt<<","<<yt << endl;
system("pause");
return 0;
}
- flowchart dan program untuk memisahkan bilangan integer <1000
#include <iostream>
#include <string>
using namespace std;
int main()
{
string raptor_prompt_variable_zzyz;
int R;
int S;
int P;
int X;
raptor_prompt_variable_zzyz ="masukkan angka = ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> X;
R =X/100;
P =(X % 100)/10;
S =X-R*100-P*10;
cout << R<<" = Ratusan" << endl; cout << P<<" = Puluhan" << endl; cout << S<<" = Satuan" << endl;
system("pause");
return 0;
}
- flowchart dan program untuk menghitung determinan matriks ordo 2x2
#include <iostream>
#include <string>
using namespace std;
int main()
{
string raptor_prompt_variable_zzyz;
int d;
int det;
int b;
int c;
int a;
raptor_prompt_variable_zzyz ="a = ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> a;
raptor_prompt_variable_zzyz ="b = ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> b;
raptor_prompt_variable_zzyz ="c = ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> c;
raptor_prompt_variable_zzyz ="d = ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> d;
det =a*d-b*c;
cout << "determinan = "<<det << endl;
system("pause");
return 0;
}
Tidak ada komentar:
Posting Komentar