Jumat, 02 September 2016

Program Penggunaan Cout Pada C++


#include <iostream.h>
#include <conio.h>

main()
{
cout<<endl;
cout<<"\t\t Hallo Apa Kabar???\n\n";
cout<<" Selamat Datang Di Lab 5 \n";
cout<<" STMIK AMIKOM Yogyakarta\n";

getch();
}

Output :


Program Penggunaan Printf Pada C


#include <stdio.h>
#include <conio.h>

main()
{
printf("\t\t Hallo Apa Kabar???\n\n");
printf(" Selamat Datang Di Lab 5 \n");
printf(" STMIK AMIKOM Yogyakarta\n");

getch();
}

Output :


Contoh Program Nama Dengan C++


#include <iostream.h>
#include <conio.h>

main()
{
cout<<"Nama : Pungki Ana Dewi"<<endl;
cout<<"NIM : 14.11.7751"<<endl;

getch();
}

Output :


Contoh Program Nama Dengan C


#include <stdio.h>
#include <conio.h>

main()
{
printf("Nama : Pungki Ana Dewi\n");
printf("NIM : 14.11.7751\n");

getch();
}

Output :


Program Harga Dengan C++


#include <iostream.h>
#include <conio.h>

int main()
{
int jumlah;
float harga_per_satuan, harga_total;
jumlah = 50;
harga_per_satuan = 15.7;

harga_total = jumlah * harga_per_satuan;

cout<<"Jumlah = "<<jumlah<<endl;
cout<<"Harga Per Satuan = "<<harga_per_satuan<<endl;
cout<<"Harga Total = "<<harga_total<<endl;

getch();
}

Output :


Program Harga Dengan C


#include <stdio.h>
#include <conio.h>

main()
{
int jumlah;
float harga_per_satuan, harga_total;
jumlah = 50;
harga_per_satuan = 15.7;

harga_total = jumlah * harga_per_satuan;

printf("Jumlah = %d\n", jumlah);
printf("Harga Per Satuan = %.1f\n", harga_per_satuan);
printf("Harga Total = %3.0f\n", harga_total);

getch();
}

Output :


Program Bilangan Pecahan Dengan C++


#include <iostream.h>
#include <conio.h>

main()
{
float a = 8.50, b = 257.23;

cout<<endl<<"Bilangan A = "<<a<<endl;
cout<<"Bilangan B = "<<b<<endl;
getch();
}

Output :