Tugas Quiz

Diposting oleh Unknown



Program ini bertujuan untuk mengetahui koordinat dan menghubungkan garis yang akan membentuk sebuah garis lurus


Screenshot :





Listing Coding :


//Ridho F N
#include <iostream.h>
#include <math.h>

void Panjang(int x_1, int x_2, int y_1, int y_2)
{
float hasil;
if(x_2==x_1)
{
hasil = abs (y_2 - y_1);
}
else if (y_2==y_1)
{
hasil= abs (x_2-x_1);
}
else
{
hasil=sqrt((x_2-x_1)*(x_2-x_1) + (y_2-y_1)*(y_2-y_1));
}
cout<<"hasil = "<<hasil;
}

Menentukan Jarak dan Kecepatan

Diposting oleh Unknown


Nih gan.. percobaan program C++ yang baru 

Menggunakan Rumus Kecepatan Gerak Lurus Beraturan t=s/v

Listing Coding :

///Menggunakan  menggunakan rumus kecepatan GLB t=s/v
#include "stdafx.h"
#include <iostream.h>

int waktu (int s,int v)
{
 int hasil;
 hasil = s / v;
 return hasil;
}

int main()
{
 int s,v,hasil;
 cout <<"MENENTUKAN WAKTU TEMPUH KENDARAAN"<<endl;
 cout <<"Masukkan nilai jarak : ";
 cin >> s;
 cout <<"Masukkan nilai kecepatan : ";
 cin >> v;
 hasil=waktu(s,v);
 cout <<"Hasil waktu tempuh = "<<hasil<<endl;
 return 0;
}

Screenshot :

Menggunakan Rumus Gerak Lurus Bergerak Beraturan

Listing Coding :

///Menggunakan Rumus GLBB

#include "stdafx.h"
#include <iostream.h>

float waktu (float vo,float vt,float a)
{
 float hasil;
 hasil = vt / (vo + a);
 return hasil;
}

int main()
{
 float vo,vt,a,hasil;
 cout <<"MENENTUKAN WAKTU TEMPUH KENDARAAN"<<endl;
 cout <<"Masukkan kecepatan awal : ";
 cin >> vo;
 cout <<"Masukkan kecepatan akhir : ";
 cin >> vt;
 cout <<"Masukkan percepatan : ";
 cin >> a;
 hasil=waktu(vo,vt,a);
 cout <<"Hasil waktu tempuh = "<<hasil<<endl;
 return 0;
}

Screenshot :