![Page 1: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/1.jpg)
CS201 RECITATION 1Introduction to C++
![Page 2: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/2.jpg)
Outline
Part 1 : Writing and debugging code with CodeBlocks
Part 2 : Porting, compiling and testing in Dijkstra
Part 3 : Using and understanding header files
![Page 3: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/3.jpg)
Part 1: Writing and debugging code with
CodeBlocks• Consider the following class:
![Page 4: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/4.jpg)
Let’s modify the GradeBook class such that
• it keeps the midterm, final, homework, and quiz grades
of a particular student as its data members
• it calculates a letter grade of the student using the
computeFinalGrade member function that
• takes four input grades from the user
• computes the average grade acc. to the following weights
• midterm (30%), final (35%), homework (15%), quiz (20%)
• assigns a letter grade according to the table
90 ≤ Grade A
80 ≤ Grade ≤ 89 B
70 ≤ Grade ≤ 79 C
60 ≤ Grade ≤ 69 D
Grade < 60 F
Otherwise U (unkown)
![Page 5: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/5.jpg)
Let’s do it using CodeBlocks
• CodeBlocks is an integrated development environment.
• http://www.codeblocks.org/downloads/26
• Make sure you download the IDE with its MinGW compiler.
![Page 6: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/6.jpg)
New C++ Project
![Page 7: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/7.jpg)
New C++ Project
![Page 8: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/8.jpg)
New C++ Project
![Page 9: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/9.jpg)
New C++ Project
![Page 10: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/10.jpg)
New C++ Project
![Page 11: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/11.jpg)
New C++ Project
![Page 12: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/12.jpg)
New C++ Project
![Page 13: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/13.jpg)
New Source File
![Page 14: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/14.jpg)
New Source File
![Page 15: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/15.jpg)
New Source File
![Page 16: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/16.jpg)
New Source File
![Page 17: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/17.jpg)
New Source File
![Page 18: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/18.jpg)
GradeBook.cpp
![Page 19: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/19.jpg)
GradeBook.cpp
![Page 20: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/20.jpg)
GradeBook.cpp
![Page 21: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/21.jpg)
GradeBook.cpp
Build & Run
![Page 22: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/22.jpg)
GradeBook.cpp
![Page 23: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/23.jpg)
GradeBook.cpp
![Page 24: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/24.jpg)
GradeBook.cpp
![Page 25: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/25.jpg)
GradeBook.cpp
![Page 26: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/26.jpg)
GradeBook.cpp
![Page 27: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/27.jpg)
GradeBook.cpp
![Page 28: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/28.jpg)
GradeBook.cpp
Alternative:
Successfully Compiled!
![Page 29: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/29.jpg)
GradeBook.cpp
![Page 30: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/30.jpg)
GradeBook.cpp
![Page 31: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/31.jpg)
GradeBook.cpp
![Page 32: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/32.jpg)
GradeBook.cpp
![Page 33: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/33.jpg)
GradeBook.cpp
![Page 34: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/34.jpg)
GradeBook.cpp
![Page 35: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/35.jpg)
GradeBook.cpp (Debugging)
Breakpoint
![Page 36: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/36.jpg)
GradeBook.cpp (Debugging)
![Page 37: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/37.jpg)
GradeBook.cpp (Debugging)
Step into
![Page 38: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/38.jpg)
GradeBook.cpp (Debugging)
![Page 39: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/39.jpg)
GradeBook.cpp (Debugging)
![Page 40: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/40.jpg)
GradeBook.cpp (Debugging)
Next line
![Page 41: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/41.jpg)
GradeBook.cpp (Debugging)
![Page 42: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/42.jpg)
GradeBook.cpp (Debugging)
Step out
![Page 43: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/43.jpg)
GradeBook.cpp (Debugging)
![Page 44: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/44.jpg)
GradeBook.cpp (Debugging)
Debug/Continue
![Page 45: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/45.jpg)
GradeBook.cpp (Debugging)
• Step Into :• Runs the program until the next instruction is reached.
• Next Line :• Runs the program until the next line of code is reached.
• Step Out :• Runs the program until the current procedure is completed.
Step Out ≥ Next Line ≥ Step Into
![Page 46: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/46.jpg)
At Break Point
Step Into
Next Line
Step Out
![Page 47: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/47.jpg)
Part 2: Porting, compiling and testing in
Dijkstra
• FileZilla (FTP client) + PuTTY (SSH Client)
• FileZilla
• https://filezilla-project.org/download.php?type=client
• PuTTY
• http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
• SSH Secure Shell
![Page 48: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/48.jpg)
Part 2: FileZilla
dijkstra.ug.bcc.bilkent.edu.tr
![Page 49: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/49.jpg)
Part 2: FileZilla
![Page 50: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/50.jpg)
Part 2: FileZilla
![Page 51: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/51.jpg)
Part 2: PuTTY
![Page 52: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/52.jpg)
Part 2: PuTTY
![Page 53: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/53.jpg)
Part 2: PuTTY
![Page 54: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/54.jpg)
Part 2: PuTTY
![Page 55: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/55.jpg)
Part 2: PuTTY
![Page 56: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/56.jpg)
Part 2: PuTTY
![Page 57: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/57.jpg)
Part 2: PuTTY
• The base command for the Gnu C++ compiler is g++
• Single File Programs
• The easiest compilation uses the command format:
• g++ -o <outputName> <cppFile>
• Example:
• g++ -o myExe prog1.cpp
• Multiple File Programs
• g++ -o <outputName> <cppFile1> <cppFile2> ...
• Example:
• g++ -o myProgram thing.cpp main.cpp
• This command compiles and links the code files "thing.cpp" and "main.cpp"together into the executable program called "myProgram”.
• g++ -o myProgram *.cpp
• This command compiles and links all the code files with ".cpp" extension.
![Page 58: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/58.jpg)
Part 2: SSH Secure Shell
![Page 59: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/59.jpg)
Part 2: SSH Secure Shell
dijkstra.ug.bcc.bilkent.edu.tr
![Page 60: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/60.jpg)
Part 2: SSH Secure Shell
![Page 61: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/61.jpg)
Part 2: SSH Secure Shell
New File Transfer Window
![Page 62: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/62.jpg)
Part 2: SSH Secure Shell
![Page 63: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/63.jpg)
Part 2: SSH Secure Shell
![Page 64: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/64.jpg)
Part 2: Types of error
• Compile Time errors
• Syntax errors
• Undeclared variables and functions, improper function calls etc.
• e.g. Forgetting to put semicolon(;) at the end of an instruction.
• Result :
• Linker errors
• Undefined functions or multiply defined functions or symbols
• e.g. Not including correct header files →
• Not using the correct namespace →
• Result :
![Page 65: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/65.jpg)
• Run-time errors
• Fatal Errors
• Typically cause the program to crash during execution
• e.g. Trying to access a non-existent memory location.
• Non-Fatal(Logical) Errors
• Does not crash the program but produce erroneous results
• Typically hardest to detect
• Result : Incorrect program behaviour
Result :
![Page 66: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/66.jpg)
Part 3: Using header files
Why do we need header files?
1. Speeds up compilation time
• Upon the change of a single line of code;
Without headers : All of the code needs to be recompiled
With headers : Only changing parts need to be recompiled
2. Keeps the code organized
• Necessary for big projects
• Allows multiple people to work on the same project
For more info : Headers and Includes: Why and How
![Page 67: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/67.jpg)
Part 3: Using header files
• Back to GradeBook.cpp
• Let’s try and separate this file into multiple files separating
the interface of the class from its implementation as well
as separating the user program that uses this code.
![Page 68: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/68.jpg)
Part 3: Using header files
![Page 69: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/69.jpg)
Part 3: Using header files
![Page 70: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/70.jpg)
Part 3: Using header files
Interface (Header, .h) File
![Page 71: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/71.jpg)
Part 3: Using header files
Implementation (.cpp) File
![Page 72: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/72.jpg)
Part 3: Using header files
Main (.cpp) File
![Page 73: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/73.jpg)
Part 3: Using header files
![Page 74: CS201 RECITATION 1 - Bilkent Universityadayanik/cs201/slides/Recitation1.pdf · 2017-10-05 · Let’s modifythe GradeBookclass such that •it keeps the midterm, final, homework,](https://reader035.vdocuments.net/reader035/viewer/2022062920/5f027aa87e708231d4047719/html5/thumbnails/74.jpg)
Part 3: Using header files