Di sini tempatnya berbagi tutorial IT.

Search This Blog

Sunday 17 November 2013

Loading Sederhana C++

Berikut ini source code-nya:
#include <iostream>
#include <conio.h>
//buat library getch(); //getch() buat nahan layar, biar tidak langsung close saat selesai. 

#include <windows.h>// untuk library system("CLS"); buat clear screen.

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    float max = 1230;
    for (int i = 1;i <= max; i++){

        //menentukan % = nilai x/jml x * 100;        
        float j = i/max*100;
        cout<<"\t Progress.. "<<j<<"%"<<ends;
        if(j==100){
            system("CLS");
            cout<<"\t"<<j<<"% Process is complete..."<<endl;
            getch();
        }
        system("CLS");
    }
    return 0;
}

Berikut ini tampilan console nya.
 



No comments:

Post a Comment

TRANSLATED