Skip to main content

CS107: C++ Programming

Page path
  • Home /
  • Courses /
  • Course Catalog /
  • Computer Science /
  • CS107: C++ Programming /
  • Unit 1: Introduction and Setup /
  • 1.3: Basics of C++
Back to 'Unit 1: Introduction and Setup '
  • 1.3: Basics of C++

      • 1.3.1: Introduction to C++

        •  C++: "Introduction" URL

          Read this article about the structure of C++ programming. Then, compile the example in the article and make sure you understand the code in each line.

      • 1.3.2: Variables, Data Types, and Constants

        •  W3Rescource: "C Variables and Data Types" URL

          Read this article about data types. Although this discusses C, the data types in C++ are exactly the same, except that C does not include a boolean variable. For now, just note that a boolean variable holds a value of either True or False. 

        • Hilze Vonck's "C++ Programming For Beginners: Variables" Page

          Watch this video, which explains how data types are used in C++.

      • 1.3.3: Basic Input and Output

        • Hoven Trainings: "Taking User Input" Page

          Watch this (admittedly robotic) video, which provides an explanation of input and output.

        •  W3Resource: "C Programming Exercises: Input-Output" URL

          Complete these exercises to check your understanding of input and output. 

      • 1.3.4: Control Structures

        •  Massachusetts Institute of Technology: John Marrero's "Flow of Control" URL

          Read these lecture notes to learn about control structures in C++ programming. Compile the examples from the notes, and make sure you understand the code in each line. After reading these notes, you should be able to define conditional structures, iteration structures, and jump statements.

      • 1.3.5: Simple Functions

          • 1.3.5.1: Scope of Variables in a Function

            •  Allen B. Downey's "How to Think Like a Computer Scientist" URL

              Read sections 3.3 to 3.10 on pages 23-30, which outline how to use and create functions. Functions are small segments of code that are removed from the normal code flow, and they are called to perform specific actions. After the function executes, control returns back to the normal flow. Within a function, data may be sent and returned to the rest of the program.

          • 1.3.5.2: Arguments Passed by Value and by Reference

            •  Harding University: Frank McCown's "Passing Arguments by Value and by Reference" URL

              Read this article, which explains how data is passed between functions. When data is passed by value, the actual contents of the variable is passed. However, with some data, you may instead simply want the program to access the data directly from the current location where it is stored. To do this, you pass the value by reference, which tells the function to access the address of the variable. 

            •  Google Code: "C++ Class: Problem Set 1" URL

              Take these six quizzes in Problem Set 1. After you finish, check your answers against those provided.

      Navigation

      Art History
      Biology
      Business Administration
      Chemistry
      Communication
      Economics
      English
      History
      Mathematics

      Creative Commons License
      © Saylor Academy 2010-2018 except as otherwise noted. Excluding course final exams, content authored by Saylor Academy is available under a Creative Commons Attribution 3.0 Unported license. Third-party materials are the copyright of their respective owners and shared under various licenses. See www.saylor.org/open/licensinginformation for detailed licensing information.

      Saylor Academy and Saylor.org® are trade names of the Constitution Foundation, a 501(c)(3) organization through which our educational activities are conducted.

      Terms of Use | Privacy Policy