Tutorial 3 More C and ADT - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

Tutorial 3 More C and ADT

Description:

Tutorial 3 More C++ and ADT * Admin Some students have moved to different class Changes have been reflected in the attendance list See the last few lines Compare this ... – PowerPoint PPT presentation

Number of Views:54
Avg rating:3.0/5.0
Slides: 8
Provided by: StevenH47
Category:

less

Transcript and Presenter's Notes

Title: Tutorial 3 More C and ADT


1
Tutorial 3More C and ADT
2
Admin
  • Some students have moved to different class
  • Changes have been reflected in the attendance
    list
  • See the last few lines
  • Compare this scenario with our question 2
  • If I put these students (who moved to different
    group) in alphabetical order, I need to shift the
    rest downwards
  • I do not want to print the attendance list again
  • No more swap request will be entertained
  • Please try to achieve 100 attendancein your
    respective class

3
Error Handling (in C)
  • When a (runtime) error happens
  • There are many ways to handle it
  • Print error message,
  • Re-do the task,
  • Quit program, etc
  • Using throw and catch
  • We will see this in action later in Q1
  • throw and catch is also available in Java

4
Abstract Data Type (ADT)
  • Abstract Data Type
  • Data Operations (Algorithms) to organize that
    data structure
  • Data Structure Structure of Data, structure
    makes life easier
  • Algorithm Step by step way to solve certain
    problem
  • Walls We do not need to know the implementation
    details
  • Examples Complex Number, Sphere,
    ColoredSphereSphere, List, etc
  • Wait! Contradictions?
  • We are given so many implementation details here!
    Why bother?
  • In fact, we are going to do that throughout this
    module ?
  • To give you a strong theoretical foundation
  • Later on, you will just use these ADTs for your
    programming tasks
  • Like C STL

5
C Standard Template Library
  • C has Standard Template Library (STL)
  • This library can simplify your life
  • Reference
  • http//www.cppreference.com
  • Todays topic is STL Vector
  • Your friend who do Q2 will show some ideas
  • Throughout the semester, we will learn more

6
Classes in C to Implement ADT
  • Basic pattern
  • In header file ? .hclass C public //
    the opening in the wall // put
    constructor/destructor and public methods here
    (accessor/mutator/etc) private // put
    hidden attributes or local methods here
  • In implementation file ? .cppinclude
    header_file_name.hCC() // constructor here
    CC() // destructor here Cmethodname()
    // implementation here

7
Student Presentation (Q3 longer)
  • T5
  • LAU WAI HOE AARON
  • LEONARDUS ADI PRASETYA
  • LI JIALONG
  • T10
  • HU FAN
  • IMANTHI UDESHINI D B
  • JIANG YONGBO
  • T13
  • FAN LANLAN
  • GAO MINMIN
  • HAO SHUAI
  • T9
  • HOO CHIN HAU
  • KALYANI IYER
  • KOAY ZI HAO
  • T17
  • CHENG LULU
  • CHEW JIE BIN ELROY
  • CHONG LEE KEE
Write a Comment
User Comments (0)
About PowerShow.com