Penggunaan Perulangan Do..While pada Bahasa C++

Latihan Modul 6.2

Nama : Haidi

No.Reg : 49031064

  1. Ubah Tampilan diatas dengan menggunakan pengulangan do…while sebanyak 4 kali, denan format tampilan seperti berikut :

modul6.2

 

  1. // Modul6.2.cpp : Defines the entry point for the console application.
  2. //Nama : Haidi
  3. //NIM : 49013064
  4. #include “stdafx.h”
  5. #include <iostream>
  6. using namespace std;
  7. int _tmain(int argc, _TCHAR* argv[])
  8. {
  9.        int pencacah = 1,a=1, b=1, c=1;
  10.        do
  11.        {
  12.               cout <<” D4 – Teknologi Media Digital” <<endl;
  13.               pencacah++;
  14.        }
  15.        while (pencacah <=2);
  16.        do
  17.        {
  18.               cout <<“Teknik Elektro ITB” <<endl;
  19.               a++;
  20.        }
  21.        while (a <=2);
  22.        do
  23.        {
  24.               cout <<“Tahun Masuk 2010” <<endl;
  25.               b++;
  26.        }
  27.        while (b <=2);
  28.        do
  29.        {
  30.               cout <<“Angkatan 2” <<endl;
  31.               c++;
  32.        }
  33.        while (c <=2);
  34. system(“pause”);
  35. return(0);
  36. }

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s