Kompetensi Mahasiswa mampu menggunakan rutin yang ada dalam









- Slides: 9
Kompetensi : Mahasiswa mampu menggunakan rutin yang ada dalam STL C++ #2. 16 Maret 2012
Kompetensi 2, 3 • • #include <iostream. h> #include <list. h> • • • int main() { list<char> coll; // list container for character elements • • // append elements from 'a' to 'z' for (char c='a'; c<='z'; ++c) { coll. push_back(c); } • • • system("PAUSE"); return 0; } Latihan 2 -3. 1
Kompetensi 2, 3 • #include <iostream. h> • #include <list. h> • int main() • { • list<char> coll; • • } // list container for character elements // append elements from 'a' to 'z' for (char c='a'; c<='z'; ++c) { coll. push_front(c); } system("PAUSE"); return 0; Latihan 2 -3. 2
Kompetensi 2, 3, 4 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. #include <iostream. h> #include <list. h> int main() { list< ………. . > coll; } // list container for integer elements // append elements from 1 to 20 for (int c=1; c<=20; ++c) { coll. push_back(c); } system("PAUSE"); return 0; Latihan 2 -4. 1
Kompetensi 2, 3, 4 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Latihan 2 -4. 2 #include <iostream. h> #include <………………> int main() { list<int> coll; } // list container for integer elements // append elements from 1 to 20 for (int c=1; c<=20; ++c) { coll. push_back(c); } system("PAUSE"); return 0; Di Memori List 1 2 3 4 5 6 7 8 9 10 11 ………. . 20
Kompetensi 2, 3, 4 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Latihan 2 -4. 3 #include <iostream. h> #include <………………> int main() { list<int> coll; } // list container for integer elements // append elements from 1 to 20 for (int c=1; c<=20; ++c) { coll. ______(c); } system("PAUSE"); return 0; Di Memori List 20 19 18 17 16 15 14 …. . 5 4 3 2 1
Kompetensi 2, 3, 4 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. #include <iostream. h> #include <list. h> int main() { list<int> coll; Latihan 2 -4. 4 // list container for character elements // append elements from 1 to 20 for (int c=1; c<=20; ++c) { coll. push_front(c); } while (! coll. empty()) { cout << coll. front() << ' '; coll. pop_front(); } cout << endl; } system("PAUSE"); return 0; Di Layar 20 19 18 17 16 15 14 …. . 5 4 3 2 1
Kompetensi 2, 3, 4 • • #include <iostream. h> #include <list. h> • • • int main() { list<int> coll; // list container for character elements • • // append elements from 1 to 20 for (int c=1; c<=20; ++c) { coll. push_front(c); } • • • while (! coll. empty()) { cout << coll. back() << ' '; coll. pop_back(); } cout << endl; • • • system("PAUSE"); return 0; } Latihan 2 -4. 5 Dilayar ? Salah atau Benar 20 19 18 17 16 15 14 …. . 5 4 3 2 1
Tugas • Membuat makalah yang mengupas isi header list. h. • Makalah dibuat per 5 orang • Dikumpulkan tgl 22 Maret 2012 melalui e-mail aetthea@yahoo. com, yogi. ramadhani@gmail. com