Minggu, 27 Desember 2015

TUGAS KELOMPOK PERTEMUAN 9

* mencari nilai MAX dan MIN.

#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <iomanip.h>
#include <windows.h>

void judul()
{
cout<<" MENENTUKAN NILAI MAXIMUM DAN MINIMUM"<<endl;
cout<<"++++++++++++++++++++++++++++++++++++++++"<<endl;
}

main()
{
int nilai[10]={55,71,28,14,68,20,33,31,9,12};
int i,n=10,max,min;

cout<<endl;
cout<<" NAMA KELOMPOK"<<endl;
cout<<" 1. FITRI ENDANG LESTARI      [NIM : 11150264]  "<<endl;
cout<<" 2. EVI MONICA GINTING        [NIM : 11150528]  "<<endl;
cout<<" 3. SANDI KURNIAWAN RAMADHAN  [NIM : 11151190]  "<<endl;
cout<<" 4. WILDAN AGUNG MAULANA      [NIM : 11152075]  "<<endl;
cout<<" KELAS  : 11.1B.27 "<<endl;
cout<<" TAHUN AJARAN   : 2015/2016 "<<endl;
cout<<endl;
judul();
cout<<endl;
cout<<" DIKETAHUI NILAI = ";
for (i=0;i<10;i++)
{cout<<nilai[i]<<" ";}
cout<<endl;
max=min=nilai[0];
for(i=0;i<n;)
{
if (nilai[i]>max)
 {max=nilai[i];}
else if (nilai[i]<min)
 {min=nilai[i];}
 i++;
}
cout<<endl;
cout<<" MAXIMUM NILAI DI ATAS = "<<max<<endl;
cout<<endl;
cout<<" MINIMUM NILAI DI ATAS = "<<min<<endl;
getch();
}


* Matrix
Tugas Kelompok (max 5 orang)

Buatlah program dengan menggunakan C++
1. penjumlahan dua buah Matriks
2. Pengurangan dua buah Matriks

ket :
> Masing-masing kelompok dapat memilih salah satu dari
   program di atas.
> listing program & output dicetak.
> Nama, Nim dan Kelas dicetak di listing Program.

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

void judul()
{
cout<<"                **MatriX**                 "<<endl;
cout<<"============================================"<<endl;
}

main()
{
int i,j;
int mat1[5][5];
int mat2[5][5];
int mat3[5][5];

cout<<endl;
cout<<" NAMA KELOMPOK"<<endl;
cout<<" 1. FITRI ENDANG LESTARI      [NIM : 11150264]  "<<endl;
cout<<" 2. EVI MONICA GINTING        [NIM : 11150528]  "<<endl;
cout<<" 3. SANDI KURNIAWAN RAMADHAN  [NIM : 11151190]  "<<endl;
cout<<" 4. WILDAN AGUNG MAULANA      [NIM : 11152075]  "<<endl;
cout<<" KELAS  : 11.1B.27 "<<endl;
cout<<" TAHUN AJARAN   : 2015/2016 "<<endl;
cout<<endl;
judul();
cout<<endl;
for(i=0;i<=1;i++)
{
 for(j=0;j<=1;j++)
 {
 cout<<" Input MATRIX A ke- "<<"["<<i<<"]"<<"["<<j<<"]"<<" : ";
 cin>>mat1[i][j];
 }
}
cout<<endl;
cout<<" MATRIX A "<<endl;
cout<<endl;
for(i=0;i<=1;i++)
{
 for(j=0;j<=1;j++)
 {
  cout<<setiosflags(ios::right)<<setw(4)<<mat1[i][j];
 }
  cout<<endl;
}
// MATRIX B
cout<<endl;
for(i=0;i<=1;i++)
{
 for(j=0;j<=1;j++)
 {
 cout<<" Input MATRIX B ke- "<<"["<<i<<"]"<<"["<<j<<"]"<<" : ";
 cin>>mat2[i][j];
 }
}
cout<<endl;
cout<<" MATRIX B "<<endl;
cout<<endl;
for(i=0;i<=1;i++)
{
 for(j=0;j<=1;j++)
 {
  cout<<setiosflags(ios::right)<<setw(4)<<mat2[i][j];
 }
  cout<<endl;
}
//penjumlahan mat c

cout<<endl;
cout<<" PENJUMLAHAN "<<endl;
cout<<" MATRIX A + B "<<endl;
cout<<endl;
for(i=0;i<=1;i++)
{
 for(j=0;j<=1;j++)
 {
  mat3[i][j]=mat1[i][j]+mat2[i][j];
  cout<<setiosflags(ios::right)<<setw(4)<<mat3[i][j];
 }
  cout<<endl;
}
//pengurangan mat c
cout<<endl;
cout<<" PENGURANGAN "<<endl;
cout<<" MATRIX A - B "<<endl;
cout<<endl;
for(i=0;i<=1;i++)
{
 for(j=0;j<=1;j++)
 {
  mat3[i][j]=mat1[i][j]-mat2[i][j];
  cout<<setiosflags(ios::right)<<setw(4)<<mat3[i][j];
 }
  cout<<endl;
}
getch();
}


Tidak ada komentar:

Posting Komentar

TUGAS KELOMPOK PERTEMUAN 13

* Buatlah Shortest path problem untuk graph dibawah ini. > cara penyelesaian SHORTEST PATH PROBLEM     - pertama : Melihat proses si...