Intro C++ Programming WINDSOR-ESSEX FIRST ROBOTICS WWW.WINDSORESSEXFIRST.ORG.

Slides:



Advertisements
Similar presentations
Pass by Value. COMP104 Pass by Value / Slide 2 Passing Parameters by Value * A function returns a single result (assuming the function is not a void function)
Advertisements

Exercise 2.
Data Structures (Second Part) Lecture 2 : Pointers Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University.
Chapter 8 Scope, Lifetime and More on Functions. Definitions Scope –The region of program code where it is legal to reference (use) an identifier Three.
Tinaliah, S. Kom.. * * * * * * * * * * * * * * * * * #include using namespace std; void main () { for (int i = 1; i
Triana Elizabeth, S.Kom. #include using namespace std; void main () { for (int i = 1; i
While Loops Programming. COMP102 Prog Fundamentals I: while Loops/Slide 2 Shortcut Assignments l C++ has a set of shortcut operators for applying an operation.
Computer Science 1620 Loops.
CS Sept Your first C++ program… Boilerplate // Cannon, demo program #include using namespace std; int main() {// program goes here… return.
More on Functions Programming. COMP104 Lecture 19 / Slide 2 Passing Parameters by Reference l To have a function with multiple outputs, we have to use.
// Functions that take no arguments #include using namespace std; void function1(); void function2( void ); int main() { function1(); function2(); return.
Wednesday, 9/4/02, Slide #1 1 CS 106 Intro to CS 1 Wednesday, 9/4/02  Today: Introduction, course information, and basic ideas of computers and programming.
 2006 Pearson Education, Inc. All rights reserved Midterm review Introduction to Classes and Objects.
1 CS 105 Lecture 4 Selection Statements Wed, Jan 26, 2011, 6:05 pm.
Computer Science 1620 Function Scope & Global Variables.
Computer Science 1620 Programming & Problem Solving.
1 CS150 Introduction to Computer Science 1 Exponents & Output page & Section 3.8.
1 9/26/07CS150 Introduction to Computer Science 1 Exponents & Output page & Section 3.8.
What is the out put #include using namespace std; void main() { int i; for(i=1;i
Loops Programming. COMP104 Lecture 9 / Slide 2 Shortcut Assignment l C++ has a set of operators for applying an operation to a variable and then storing.
Computer Science 1620 Lifetime & Scope. Variable Lifetime a variable's lifetime is finite Variable creation: memory is allocated to the variable occurs.
Programming Part 1 Armond R. Smith Zhenying Wu. Overview of this Class ● Transition from FTC -> FRC ● Using Your Resources ● Java Keywords o Data Types.
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
C++ Tutorial Hany Samuel and Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright © 2006 by Douglas.
Current Assignments Homework 3 is due tonight. Iteration and basic functions. Exam 1 on Monday.
CHAPTER 7 DATA INPUT OUTPUT Prepared by: Lec. Ghader R. Kurdi.
Functions CIS Feb-06. Summary Slide Using Functions Mathematical Functions Misc. Functions Naming Conventions Writing Functions –Function Prototype.
While Loops Programming. COMP102 Prog Fundamentals I: while Loops/Slide 2 Shortcut Assignments l C++ has a set of shortcut operators for applying an operation.
Lecture 3: The parts of a C++ program (Cont’d) Professor: Dr. Miguel Alonso Jr. Fall 2008 CGS2423/COP1220.
1 Original Source : and Problem and Problem Solving.ppt.
Lecture 7: Making Decisions Professor: Dr. Miguel Alonso Jr. Fall 2008 CGS2423/COP1220.
Objective: Students will be able to: Declare and use variables Input integers.
#include using namespace std; // Declare a function. void check(int, double, double); int main() { check(1, 2.3, 4.56); check(7, 8.9, 10.11); } void check(int.
Jon Cardwell Red Alert Robotics Team 1741 October 24, 2015.
Lecture – Pointers1 C++ Pointers Joseph Spring/Bob Dickerson School of Computer Science Operating Systems and Computer Networks Based on notes by Bob Dickerson.
DATA STRUCTURE & ALGORITHMS Pointers & Structure.
Chapter 3 – Variables and Arithmetic Operations. First Program – volume of a box /************************************************************/ /* Program.
3. The Nuts and Bolts of C++ Computer Programming 3. The Nuts and Bolts of C++ 1 Learning the C++ language 3. The Nuts and Bolts of C++ 16 September 2008.
Think First, Code Second Understand the problem Work out step by step procedure for solving the problem (algorithm) top down design and stepwise refinement.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني Object Oriented Programming(Objects& Class) Classes are an expanded concept of data structures: like.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني Destructors The destructor fulfills the opposite functionality. It is automatically called when an object.
Test Review. General Info. All tests will be comprehensive. You will be tested more on your understanding of code as opposed to your ability to write.
Classes Sujana Jyothi C++ Workshop Day 2. A class in C++ is an encapsulation of data members and functions that manipulate the data. A class is a mechanism.
Introduction to Programming Lecture 6. Functions – Call by value – Call by reference Today's Lecture Includes.
Structure A Data structure is a collection of variable which can be same or different types. You can refer to a structure as a single variable, and to.
A Sample Program #include using namespace std; int main(void) { cout
Intro. to Computer Programming Eng. Nehal A. Mohamed Spring Semester-2016.
CS 31 Discussion, Week 2 Faisal Alquaddoomi, Office Hours: BH 2432, MW 4:30-6:30pm, F 12:30-1:30pm (today)
Chapter five exercises. a. false; b. true; c. false; d. true; e. true; f. true; g. true; h. false.
Looping I (while statement). CSCE 1062 Outline  Looping/repetition construct  while statement (section 5.1)
Chapter 5 Classes.
Introduction to C++ October 2, 2017.
Programming Fundamentals
solve the following problem...
C++ Arrays.
Function Basics.
CS 1430: Programming in C++ Turn in your Quiz1-2 No time to cover HiC.
C++ fundamentals Lecture 1, Chapter 2 – pp /22/2018 Y K Choi.
Lesson 4: Overall Review and Assessment
הרצאה 03 אבני היסוד של תוכנית ב- C
Counting Loops.
Starting Out with C++: From Control Structures through Objects
Code::Block vs Visual C++
Lab 1 Introduction to C++.
If Statements.
Statements and flow control
Introduction to Programming
Repetition Statements (Loops) - 2
Introduction to Programming
Presentation transcript:

Intro C++ Programming WINDSOR-ESSEX FIRST ROBOTICS

What will we cover today Understanding the sample code Understanding of basic C++ operations and data structures Resources for continued learning

Technical Resources The FRC website has GREAT resources for this years new hardware. ◦ ◦Covers Labview, C++, and Java

More Resources Chief Delphi Great resource – A forum with other FRC students, sharing and answering questions

Sample C++ Code

Variables A variable is a container for data that needs to be used for other steps. Int, Float, Boolean are simple data variables RobotDrive, Joystick are complex objects. These objects store lots of data in a known structure.

Sample C++ Code Functions Contain code that can be easily called by other code If a section of code will be reused in more than one place, a function is an easy way to keep your code organized, as well as easy to change in the future

Sample C++ Code Loops A code loop will loop until conditions are no longer met. In this case, we will loop through the tele operated code until we are no longer Enabled or In Tele Operated Mode.

Sample C++ Code Object Structures - RobotDrive RobotDrive is a data structure that contains both variables and functions In C++ these variables and functions can be accessed using the “.” or “->” to refer to an objects structure. Example myDrive.arcadeDrive(driveStick)

Sample C++ Code Object Structures Jaguar *exampleJaguar = new Jaguar(0); exampleJaguar->Set(0.7); gyro = new Gyro(1); double angle = gyro.getAngle();

C++ Coding – Your Turn #include using namespace std; int main () { int i; cout << "Please enter an integer value: "; cin >> i; cout << "The value you entered is " << i; cout << " and its double is " << i*2 << ".\n"; return 0; }

C++ Coding – Your Turn #include using namespace std; int addition (int a, int b) { int r; r=a+b; return r; } int main () { int z; z = addition (5,3); cout << "The result is " << z; }

C++ Coding – Get Some Class #include using namespace std; class Rectangle { int width, height; public: void set_values (int,int); int area() {return width*height;} }; void Rectangle::set_values (int x, int y) { width = x; height = y; } int main () { Rectangle rect; rect.set_values (3,4); cout << "area: " << rect.area(); return 0; }

Setting Up a New Project benchtop-test-program