Friday, December 23, 2011

Mengenal STRUCT dalam C++

Struct (struktur) adalah kumpulan dari beberapa variabel yang dirangkum menjadi satu tipe baru sehingga memudahkan pengaksesan beberapa data sekaligus.
Struktur dideklarasikan dengan menggunakan keyword struct. Contoh:
 
struct mhs
 {
  char nama[50];
  int  JK;
  int NRP;
 };


 Pendeklarasian variabel dapat pula dituliskan langsung setelah pendeklarasian struktur.
 Contoh:
 struct mhs
{
  char nama[50];
  int  JK;
  int NRP;
 } Mhs1, Mhs2;


Contoh program sebuah struct yang memiliki 5 elemen data penyusun struct. Sebenernya ini tugas kampus saya tapi ya saya share gapapalah bagi bagi ilmu :)

#include<stdio.h>
#define size 100
struct{
char nama[size];
char NIM[size];
int umur;
int tinggi;
int berat;
}data[size];
main()
{
int i,j,n;
printf("masukan n : ");scanf("%d",&n);
for(i=0;i<n;i++)
{
fflush(stdin);
printf("\n\nData ke-%d\n",i+1);
printf("NAMA : ");gets(data[i].nama);
printf("NIM  : ");gets(data[i].NIM);
printf("Umur : ");scanf("%d",&data[i].umur);
printf("Tinggi Badan : ");scanf("%d",&data[i].tinggi);
printf("Berat Badan  : ");scanf("%d",&data[i].berat);
}
printf("----------------------------------------------------------\n\n");
printf("Nama\t\tNIM\t\tUMUR\tTINGGI BADAN\tBERAT BADAN\n");
for(i=0;i<n;i++)
printf("%-17s%-15s%-15d%-17d%d\n",data[i].nama,data[i].NIM,data[i].umur,data[i].tinggi,data[i].berat);
getch();
return 0;
}


Dan output dari kode program tersebut ini diaa,

Semoga bermanfaat :D

Tuesday, August 16, 2011

Algoritma dan Pemrograman (pertemuan 1)

halooohaaa :D gua baru balik kuliah nih dan gua mau share apa yang tadi gua pelajari ya sekalian nginget2 lah tadi gua belajar algoritma dan pemograman okelah gausah banyak basa basi yeee

DEVINISI ALGORITMA
Algoritma adalah langkah-langkah yang di lakukan agar solusi masalah dapat di peroleh, lebih singkat bisa di bilang Algoritma adalah tahapan langkah.

BENTUK ALGORITMA
Bentuk algoritma dibagi menjadi dua yaitu:
1. Narasi
2. Flowchath

Okay pasti lo bingung loh ko jadi ada narasi kaya bahasa indonesia aja haha gua juga awalnya gitu tapi ya emang itu bentuk bentuknya. nih detailnya gua jelasin langsung ke contoh aja yaaa
ini latihan yang di kasih sama dosen gua
*Mengihitung luas segitiga
Narasi   :   1. Baca nilai tinggi dan alas
                2. Hitung Luas (alas*tinggi)/2
                3. Cetak luas
maka Flowchartnya
Flowchart : 

<<< Start


<<< Input


<<< Proses


<<< Output



<<< Stop


So yeah that's what I've learned today, hope this help you :)

What will Management Informatics be like for me?

Okay finally I got major Informatics for my study it such a good thing cause you know what i was thinkin i really wanna be a progammer and im so glad i got informatics so me and my brother we can sharing anyting everything that we dont know each other because he studying Computer Science that's so awesome!!! sooo yeah maybe someday we can work together like teamwork?lollll yeah but that's my dream now.
If you really don't have to know that much Management Informatics to take it as a major. When you learn it in university they teach it as though you're a beginner because in school you might not have learned the language that they are teaching you for example you could have learned how to used Java/html in high school but in college they might be teaching C++, designing, coding. So if  I was to learn C++ they would have to show use object oriented stuff from scratch so you really don't have to know a lot of the informatics aspects but to let you know, they go through it pretty fast.
Now since im going to university we're going to have to be good at math and science so I would learn some calculus and linear algebra and for the science part I don't think we need to much because informatics doesn't really have too much to do with the different sciences , so all we really have to know is advanced math and then we should be able to get by.... But if we're taking on programming then we can't "kind of like it" we have to love it. If we don't love it then we're going to fail because we'll run into a lot of problems and we'll get stressed and we'll start to hate it  If you want to get into like building computers and stuff then take computer engineering because its differnet between informatics and computer engineering :) that's what my seniors says D:

So yeah now i know what will Management Informatics be like for me? lol