Tugas Alpro PPT Minggu ke 4 Kasus 4.1


Mencetak Bilangan 1 sampai 4

1. Deklarasi
     int i;
     for loop;
2. Deskripsi
    for 1 <= 1 to 4 do
    write(i)
    end for


Logikanya Menggunakan Flowchart

Proggram C++

#include <iostream>
using namespace std;
class looping{
public:
void bilangan ();
void rumus ();
private:
int a;
};
void looping::bilangan() {
cout<<"==================================================================="<<endl;
cout<<"program untuk menampilkan bilangan 1-4 menggunakan perulangan while"<<endl;
cout<<"==================================================================="<<endl;
}
void looping::rumus() {
a=1;
while(!(a>4)){
cout<<" "<<a<<endl;
a=a+1;
}
}

int main(int argc, char** argv) {
looping maulana;
maulana.bilangan();
maulana.rumus();
system("pause");
return 0;

}
 
 

Share this:

ABOUT THE AUTHOR

Ceyron Louis

A web designer from India. And then you write some more information about yourself like this to fill out the space that is left.

0 komentar:

Posting Komentar