Minggu, 07 Juni 2015

Program C++ - Titik Tengah

Program C++ - Titik Tengah

Hello, guys... Jumpa lagi di blog ku yang sederhana ini.
yaa.. Setelah beberapa minggu lamanya aku vakum dari dunia blogger dikarenakan saking banyaknya tugas kuliah hingga membuatku lupa sejenak sama blogku tercinta ini, kini aku kembali lagi untuk sekedar berbagi ilmu dengan kalian wahai para sahabat bukailmu... 
Kali ini aku akan sharing ilmu mengenai program titik tengah menggunakan bahasa C++. Karena aku tidak suka berbasa-basi jadi langsung saja aku share programnya yaa.. Ini dia source code dari program C++ Titik Tengah yang pernah aku buat... 

/* Program HitungTitikTengah */ 
/* Program untuk menghitung titik tengah dari dua buah titik di bidang. */ 
#include <iostream>

using namespace std;


int main(int argc, char *argv[]) {

struct Titik{ 
float x,y; 
}P1, P2, P3;

cout<<"==================================\n";
cout<<"====== Program Titik Tengah ======\n";
cout<<"========== SRI WAHYUNI ===========\n";
cout<<"=================================\n\n";
cout << " Titik P1 : " << endl; 
cout << " x = "; cin >> P1.x ; 
cout << " y = "; cin >> P1.y ; 
cout << " Titik P2 :" << endl; 
cout << " x = "; cin >> P2.x ;
cout << " y = " ; cin >> P2.y ; 
P3.x = (P1.x + P2.x)/2; 
P3.y = (P1.y + P2.y)/2; 

cout << " Titik Tengah : ( "<< P3.x << ","<< P3.y<<" )" ; 

 return 0;



berikut ini adalah hasil tampilan setelah dicompile : 





Related Posts:

  • C++ PROGRAM BILANGAN (terbesar, terkecil, rerata)C++ PROGRAM BILANGAN (terbesar, terkecil, rerata) #include <iostream> /* 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 … Read More
  • C++ PROGRAM DERET FIBONACCI ITERATIF C++ PROGRAM DERET FIBONACCI ITERATIF #include <iostream> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; void fibonacci(int N){ int U1 = 0, U2 … Read More
  • C++ Program Jam Digital (tanpa CLASS )Program Jam Digital Bahasa C++ ( tanpa CLASS ) #include <iostream> #include <ctime> #include <cstdlib> #include <windows.h> /* run this program using the console pauser or add your own getch, system("… Read More
  • C++ PROGRAM MENCARI BILANGAN TERBESAR DAN TERKECIL ( CLASS ) C++ PROGRAM MENCARI BILANGAN TERBESAR DAN TERKECIL  ( CLASS ) #include <iostream> #include <cstdlib> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") o… Read More
  • C++ PROGRAM PERSAMAAN KUADRAT C++ PROGRAM PERSAMAAN KUADRAT  #include <iostream> #include <math.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; int main(int ar… Read More

0 komentar:

Posting Komentar