- Flowchart :
- Pendeskripsiannya :
- Terlebih dahulu mulai dari start.
- Kemudian kita berikan penguasaan dgn inputan penguasaan “i 0”.
- Setelah itu kita tentukan pengkondisian pertamanya : “i>100”.
- Setelah itu pengkondisian keduanya : “i%3=1 and i%5=1”.
- Jika pengkondisian bernilai “yes” maka akan di masuk di pemrosesan “i i+15” tetapi jika pengkondisian bernilai “no” maka output akan di cetak sbg “i” dan akan di masuk di pemrosesan “i i+15”.
- Proses tersebut akan terus dilakukan sampai nilai “i>100” trsbt terpenuhi.
- Selesai.
- Syntax C++ :
- #include <iostream>#include <string>using namespace std;int main(){int i;i =0;while (!(i>100)){if (i % 3==1 && i % 5==1){}else{cout << i << endl; }i =i+15;}system("PAUSE");return 0;}
- Syntax C++ dengan structure Class :
- #include <cstdlib>#include <iostream>using namespace std;class bilangan{friend ostream& operator<<(ostream&, bilangan&);friend istream& operator>>(istream&, bilangan&);public:bilangan(){};void proses(){i =0;while (!(i>100)){ if (i % 3==1 && i % 5==1){}else{cout << i << endl; }i =i+15;}}private:int i;};istream& operator>>(istream& in, bilangan& masukkan){cout<<"Bilangan Yang Habis Dibagi 3 & 5 = "<<endl;in >>masukkan.i;return in;}ostream& operator<<(ostream& out, bilangan& keluaran){cout<<"Bilangannya adalah "<<keluaran.i<<endl;return out;}int main(int argc, char *argv[]){bilangan bil;cin >> bil;bil.proses();cout<< bil;cout<< endl;system("PAUSE");return 0;}
English Version :
Ø
Flowchart:
Ø
Description of:
1.
Advance from the start.
2.
Then we
give control of the control input with "i
3.
Our input recurrence (Looping).
4.
After that we specify the first conditioning:
"i> 100".
5.
After the conditioning of both: "i% 3 = 1
and i% 5 = 1".
6.
If the conditioning value "yes" then
it will be entered in the processing i
+15" but if the conditioning value "no" then the output willßof "i i
+15".be in print as "i" and will be entered in the processing of
"i+15".
7. The process will continue until the "i> 100" the met.
8.
Completed.
Ø
C + + syntax:
Ø
# Include <iostream>
# Include <string> using namespace std; int main () { int i; i = 0; while (! (i> 100)) { if (i% 3 == 1 && i% 5 == 1) { } else { cout << i << endl;} i = i +15; } system ("PAUSE"); return 0; } |
Ø
C + + syntax with Class structure:
# Include <cstdlib>
# Include <iostream> using namespace std; class number { friend ostream & operator << (ostream &, & number); friend istream & operator >> (istream &, & number); public: number () {}; void process () { i = 0; while (! (i> 100)) {If (i% 3 == 1 && i% 5 == 1) { } else { cout << i << endl;} i = i +15; } } private: int i; }; istream & operator >> (istream & in, & enter the numbers) { cout << "Numbers divisible by 3 & 5 =" << endl; in >> masukkan.i; return in; } ostream & operator << (ostream & out, numbers & output) { cout << "Bilangannya is" << keluaran.i << endl; return out; } int main (int argc, char * argv []) { number bil; cin >> bil; bil.proses (); cout << bil; cout << endl; system ("PAUSE"); return 0; } |
0 komentar:
Posting Komentar