HN-Community
C n C++ - Printable Version

+- HN-Community (https://hacker-newbie.org)
+-- Forum: Miscellaneous (https://hacker-newbie.org/forum-86.html)
+--- Forum: Coding/Programing (https://hacker-newbie.org/forum-19.html)
+--- Thread: C n C++ (/thread-2476.html)

Pages: 1 2 3 4 5 6 7 8 9


RE: C n C++ - Jacket^Cyber - 05-03-2010

konversi Jam yAh ??
hehehee..good2...

LanJutkan kawan..


RE: C n C++ - noxexploit - 05-08-2010

@TeRRen.Jr: iya pake visual hehehe

untuk belajar fungsi switch. saya ambil contoh program calculator sederhana.

Code:
#include <iostream> using namespace std; int main (void) { system("cls"); //untuk membersihkan line sebelumnya double angka1; double angka2; char operasi; //ini untuk operasi hitungnya char ulangi; // ini untuk fungsi do while nantinya do { cout << "Masukkan angka" << endl; //mengeluarkan tulisan cin >> angka1 >> operasi >> angka2; //memasukan angka dan operasi swtich(operasi) { //memulai switch untuk operasi case '+': //ketika input operasi adalah + cout << "=" << angka1 + angka2 << endl; break; case '-': //ketika input operasi adalah - cout << "=" << angka1 - angka2 << endl; break; case '/': //ketika input operasi adalah / cout << "=" << angka1 / angka2 << endl; break; case '*': //ketika input operasi adalah * cout << "=" << angka1 * angka2 << endl; break; } cout << "ingin menghitung kembali?(y/n)" << endl; cin >> ulangi; } while(ulangi=='y'||ulangi=='Y'); //ketika mengetik 'y' atau 'Y' akan //kembali ke awal }

sekian kalo ada yang salah mohon maaf ^^


RE: C n C++ - Giez - 05-08-2010

hmmm...klo Visual Basic ane kurang paham coz gx punya software-nya Malu tp klo Visual Basic 2008 EE sih ada cuman gx ngerti.

Ane lebih suka Bikin file .bat,trus dijadiin exe plus iconnya jadi deh Aplikasi sederhana.... /^.^\


RE: C n C++ - Jacket^Cyber - 05-08-2010

Mantabh codingya..
hohohoh...

LanJut sHarenya..


RE: C n C++ - noxexploit - 05-10-2010

hehehe ini ada lagi. lanjutan dari konversi suhu. menggunakan fungsi switch lagi. baru aja selesai hehehe.

Code:
#include <iostream> using namespace std; int main() { double celcius; double farenheit; double reamur; double factorfarenheit; double factorcelcius; double factorreamur; char ulangi; int option; do{ system("cls"); factorfarenheit = 212 - 32; factorcelcius = 100 - 0; factorreamur = 80 - 0; cout << "Berikut jenis konversi suhu" << endl; cout << "\n" << endl; cout << "1. Celcius ke farenheit" << endl; cout << "2. Farenheit ke celcius" << endl; cout << "3. Celcius ke reamur" << endl; cout << "4. Reamur ke celcius" << endl; cout << "5. Farenheit ke reamur" << endl; cout << "6. Reamur ke farenheit" << endl; cout << "\n" << endl; cout << "Silahkan pilih untuk melakukan convert:" << endl; cin >> option; switch(option) { case 1: cout << "Silahkan masukkan derajat celcius:" << endl; cin >> celcius; farenheit = celcius * factorfarenheit/100 + 32; cout << "Hasil dalam farenheit adalah:" << farenheit << endl; break; case 2: cout << "Silahkan masukkan derajat farenheit:" << endl; cin >> farenheit; celcius = (farenheit - 32) * factorcelcius/180; cout << "Hasil dalam farenheit adalah:" << celcius << endl; break; case 3: cout << "Silahkan masukkan derajat celcius:" << endl; cin >> celcius; reamur = celcius * factorreamur/100; cout << "Hasil dalam farenheit adalah:" << reamur << endl; break; case 4: cout << "Silahkan masukkan derajat reamur:" << endl; cin >> reamur; celcius = reamur * factorcelcius/80; cout << "Hasil dalam farenheit adalah:" << celcius << endl; break; case 5: cout << "Silahkan masukkan derajat farenheit:" << endl; cin >> farenheit; reamur = (farenheit - 32) * factorreamur/180; cout << "Hasil dalam farenheit adalah:" << reamur << endl; break; case 6: cout << "Silahkan masukkan derajat reamur:" << endl; cin >> reamur; farenheit = reamur * factorfarenheit/80 + 32; cout << "Hasil dalam farenheit adalah:" << farenheit << endl; break; } cout << "Ingin menghitung yang lain?(y/n)" << endl; cin >> ulangi; } while(ulangi=='y'||ulangi=='Y'); }

maaf kalo gak simple banget. masih newbie hehehe


RE: C n C++ - noxexploit - 05-27-2010

Sepi nih yang ngurusin C++, ayo lagi dong, pengen belajar.
Kita bermain tebak angka.

Code:
#include <iostream> #include <ctime> #include <cstdlib> using namespace std; int main () { srand(time(0)); int angkaacak = rand () % 100 + 1; int tebakkan; int coba = 0; char ulangi; do { system("cls"); cout << "\tSelamat Datang Di Game Tebak Angka" << endl; cout << "\t(Created by Rizky DS)\n" << endl; do { cout << "Masukkan Angka Dari 1 - 100: "; cin >> tebakkan; ++coba; if (tebakkan < angkaacak) cout << "Terlalu Rendah" << endl; if (tebakkan > angkaacak) cout << "Terlalu Tinggi" << endl; } while(tebakkan != angkaacak); cout << "Anda Menebak Sebanyak " << coba << " Kali" << endl; if (coba <= 5) cout << "ANDA PINTAR" << endl; if (coba >= 6) cout << "MORE PRACTICE OK?!\n" << endl; cout << "Ingin Mencoba Lagi?(y/n)" << endl; cin >> ulangi; } while(ulangi=='y'||ulangi=='Y'); }

Program perulangan kata sederhana hehehhe iseng.
Code:
#include <iostream> #include <string> using namespace std; int main () { string x; int y; int z; char ulangi; do { system("cls"); cout << "Masukkan Satu Kata Untuk Di Ulang dan Angka Untuk melakuka Pengulangan" << endl; cout << "Contoh: saya 10" << endl; cout << "Masukkan kata dan angka: "; cin >> x >> y; cout << "---------" << endl; for(z=0;z<y;z++) cout << x << endl; cout << "Ulangi Program?(y/n)" << endl; cin >> ulangi; } while(ulangi=='y'||ulangi=='Y'); }



RE: C n C++ - KARASOE - 06-03-2010

waduh agan agan maaf... saya lama gak ol brow... kena virus PB nih anjritt sakit banget kantong ana...........Sedih

asik dah nambh peminat nya...

sekali lagi saya minta maaf.. dan doaanya agar sembuh dari virus PB

waw keren keren dah pakek visual


RE: C n C++ - Jacket^Cyber - 06-10-2010

(06-10-2010, 01:22 AM)bleder Wrote: asic nich ada master C++
sy sich masih blom ngerti..makanya nyimak aja kk..

gA ngeRtinya dimAna kk ?
Jgn cUma nyimak atuh kk..

kaLo ga ngerti..tNya aJa yAh..


RE: C n C++ - bi0zcode - 07-08-2010

(03-13-2010, 03:10 PM)TeRRen.Jr Wrote: om Karose udah beLaJar C/C++ aJa neh..
hehehe..

aNe aJa bAru bisa dikit..
ne aNe share deh..

Perhitungan Luas Segitiga [simpLe]
Code:
#include <stdio.h> #include <conio.h> #include <iostream.h> main() { int alas,tinggi,luas; clrscr(); cout << "*--------------------------------------------------*"<<endl; cout << "| @CopyRight By aLdy TeRRen |"<<endl; cout << "| Contact Me : terren@cyberdos.org |"<<endl; cout << "| Visit me : http://terrenjr.co.cc |"<<endl; cout << "*--------------------------------------------------*"<<endl<<endl; cout << "Masukan Alas Segitiga : " ; cin >> alas; cout << "Masukan Tinggi Segitiga : " ; cin >> tinggi; luas=(alas*tinggi)/2; cout << "Luas Segitiga : "<<luas; getch(); }

maaf kak nanya dikit kalo salah..
ini c++ yg model lama yak? kok ane compile pake g++ di ubuntu gak mau yak? Mumet Mumet Mumet Wow


RE: C n C++ - rhecizen - 07-08-2010

baru bikin,, langsung share aj
"membuat matrik di C "
Code:
# include <stdio.h> int main(i) { system("color 02"); system("title matrix"); for(i =0;i<10;++i) { printf("%d",rand()%2); --i; } system("pause"); }

NB : tu aq bikinny di ubuntu, buat eksekusinya gunain gcc

semoga bermanfaat :D