Devilzc0de Forum Follow @devilzc0de
  • Home
  • Hacking
  • Networking
  • Programming
  • O.S
  • Server
  • Tweets
  • Search
  • Member List
  • Calendar
Current time: 05-22-2013, 07:34 AM Hello There, Guest! (Login — Register)
Devilzc0de Forum › Information Technology › Programming › C / C++ v
« Previous 1 ... 6 7 8 9 10 ... 15 Next »

[Tutor] Perulangan while tersarang

Home General Computer Multimedia Business Lounge

Post Reply 
Tweet
Threaded Mode | Linear Mode
Tutor Perulangan while tersarang
02-25-2012, 02:15 PM
Post: #1
chiboga Offline
./Devilz Advisor
Posts: 694
Joined: Nov 2011
Reputation: 24
Perulangan while tersarang
Kembali Lagi Dengan Saya ..!!
ngakakngakak

Stelah Bljar Perulangan While Kali Ini Saya Akan Coba Bagi Perulangan Whiel Tersarang
Ne Pengertiannya ...!!!
smangatsmangat
Perulangan while tersarang maksudnya adalah di dalam suatu statement while terdapat statement while lainnya.
Code:
while (Ekspressi1)
{    statement1;
    statement2;
    ...
    while (Ekspressi2)
    {    statement1;
        statement2;
        ...
        [break;]
    }
    [break;]
}

ne contoh program sederhananya, silahkan di kembangkan ya
Code:
#include <iostream.h>
#include <conio.h>

void main()
{     char tekan;
      while (1)
      {     int i,n;
            cout << "Program untuk menampilkan bilangan dari 1 s.d. n\n";
            cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n";
            cout << "Ingin menampilkan sampai bilangan berapa ? ";
            cin >> n;
            i=0;
            while (i<n)
            {     i=i+1;
                  cout << i << endl;
            }
            cout << "Ingin dilanjutkan [Y/T] ";
            tekan=' ';
            while (!(tekan=='Y' || tekan=='y' || tekan=='T' || tekan=='t'))
            {tekan=getch();}
            cout << tekan << endl << endl;
            if (tekan=='T' || tekan=='t') break;
      }
}

SS nya ne
[Image: WhileTersarang.jpg]

Selamat Mencoba Ya, Bagi Yang Kurang NGerti Silahkan Di Tnya
belajarbelajar
Find all posts by this user
Quote this message in a reply
 Reputed by :  ./ rex(+1)
02-25-2012, 02:24 PM
Post: #2
lita_kira Offline
./Devilz 1st Cadet
Posts: 4
Joined: Jan 2012
Reputation: 1
RE: Perulangan while tersarang
mantap kak
ijin di bookmark dlo ya kak ...!!!

belajarbelajar
Find all posts by this user
Quote this message in a reply
02-25-2012, 02:29 PM
Post: #3
chiboga Offline
./Devilz Advisor
Posts: 694
Joined: Nov 2011
Reputation: 24
RE: Perulangan while tersarang
(02-25-2012 02:24 PM)lita_kira Wrote:  mantap kak
ijin di bookmark dlo ya kak ...!!!

belajarbelajar
hore
kalau gak ngerti silahkan di tanyak ...!!
smoga sukses

smangatsmangat
Find all posts by this user
Quote this message in a reply
02-25-2012, 02:47 PM
Post: #4
Fauzi Topan Offline
PacarNya Yuki Kato
Posts: 314
Joined: Nov 2011
Reputation: 55
RE: Perulangan while tersarang
terima kasih bang, mudah dimengerti mantap
Visit this user's website Find all posts by this user
Quote this message in a reply
02-25-2012, 02:47 PM (This post was last modified: 02-25-2012 02:48 PM by RieqyNS13.)
Post: #5
RieqyNS13 Offline
./Devilz Officer
Posts: 131
Joined: Dec 2011
Reputation: 40
RE: Perulangan while tersarang
klo ane pke Dev-C++, iostream.h nya diganti dgn iostream aja, trus setelah ane mengincludekan librarynya, ane kasih
using namespace std;
trus void main() ane ganti dgn int main()

Code:
#include <iostream>
#include <conio.h>
using namespace std;
int main()

hmm..sdikit bedanya..btw, itu code cpp nya agan compile pke apaan ?
Visit this user's website Find all posts by this user
Quote this message in a reply
02-26-2012, 11:09 PM
Post: #6
jackerp Offline
./Devilz Advisor
Posts: 576
Joined: Jan 2011
Reputation: 41
RE: Perulangan while tersarang
mas..
ane udah coba kok error....
kang ,,aku pakek CodeBlock
Visit this user's website Find all posts by this user
Quote this message in a reply
02-26-2012, 11:31 PM
Post: #7
KataM Offline
./Devilz Commodore
Posts: 1,231
Joined: Feb 2011
Reputation: 41
RE: Perulangan while tersarang
(02-26-2012 11:09 PM)jackerp Wrote:  mas..
ane udah coba kok error....
kang ,,aku pakek CodeBlock
try, tambahin di header'nya
Code:
#include <iostream>
#include <stdio.h>
using namespace std;
ganti void main() dengan int main()
Find all posts by this user
Quote this message in a reply
02-27-2012, 11:58 AM (This post was last modified: 02-27-2012 12:02 PM by chiboga.)
Post: #8
chiboga Offline
./Devilz Advisor
Posts: 694
Joined: Nov 2011
Reputation: 24
RE: Perulangan while tersarang
(02-25-2012 02:47 PM)Fauzi Topan Wrote:  terima kasih bang, mudah dimengerti mantap

same2 om
smangatsmangat

(02-25-2012 02:47 PM)RieqyNS13 Wrote:  klo ane pke Dev-C++, iostream.h nya diganti dgn iostream aja, trus setelah ane mengincludekan librarynya, ane kasih
using namespace std;
trus void main() ane ganti dgn int main()

Code:
#include <iostream>
#include <conio.h>
using namespace std;
int main()

hmm..sdikit bedanya..btw, itu code cpp nya agan compile pke apaan ?

hehehehe
compile yang bagaimana om ...??
kalu di borland c++ kan tinggal di jalanin aja pake run

(02-26-2012 11:09 PM)jackerp Wrote:  mas..
ane udah coba kok error....
kang ,,aku pakek CodeBlock

error di mananya mbak ...???
itu contoh yang sangat simple loch
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


Topic Tools
Topic Link :
BBCode :
HTML Code :
View a Printable Version Send Thread to a Friend Subscribe to this thread
Submit Google Submit Face book Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Tutor] Statement If Tersarang chiboga 8 338 06-01-2012 11:05 AM
Last Post: chiboga
  [Tutor] perulangan mengurutkan abjad a..z katob al mubarrak 2 306 05-30-2012 12:02 PM
Last Post: CitooZz
  [Tutor] Perulangan dengan while chiboga 5 515 02-25-2012 12:58 PM
Last Post: chiboga

Users Browsing
1 Guest(s)

  • Contact Us
  • devilzc0de
  • Return to Top
  • Mobile Version
  • RSS Syndication
  • Help
Current time: 05-22-2013, 07:34 AM Powered By MyBB, © 2002-2013 MyBB Group. Theme created by Justin S. | Mixed By Chaer.Newbie | Fixed By Aditya

USING THIS SITE INDICATES THAT YOU HAVE READ AND ACCEPT OUR TERMS. IF YOU DO NOT ACCEPT THESE TERMS, YOU ARE NOT AUTHORIZED TO USE THIS SITE