Selasa, 15 Maret 2016

Contoh Penggunaan do while

#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

using namespace std;
int main(int argc, char** argv) {
    int a=2, b=3;
    string j;
    do{
        cout<<endl;
        cout<<"mau mengulang y/n :";
        cin>>j;
        cout<<endl;
        if(j=="y" or j=="Y"){
            cout<<"luas persegi panjang :"<<a*b;
        }
    }while (j=="y" or j=="Y");
    return 0;
}

Tidak ada komentar:

Posting Komentar