Looping C++

1. For dalam C++

#include <iostream>

using namespace std;

int main()
{
int forme;
cout<<“Masukkan Perulangan For = “;
cin>>forme;
for(int i=0;i<forme;i++)
{
cout<<“Rakhmawati Lestari”<<endl;
}
return forme;
}

2. While dalam C++

#include <iostream>

using namespace std;

int main()
{
int whileme;
int i=0;
cout<<“Masukkan Perulangan While = “;
cin>>whileme;
while(i<whileme)
{
cout<<“While Rakhmawati Lestari”<<endl;
i++;
}
return whileme;
}

3. Do While dalam C++

#include <iostream>

using namespace std;

int main()
{
int dowhme;
int i = 0;
cout<<“Masukkan Perulangan Do While = “;
cin>>dowhme;
do
{
cout<<“Do While Rakhmawati Lestari”<<endl;
i++;
}
while(i<dowhme);
return dowhme;
}

2 thoughts on “Looping C++

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s