The document provides an introduction to C++ programming. It outlines topics that will be covered such as basic syntax, compiling programs, argument passing, dynamic memory, and object-oriented programming. It recommends some useful books and websites for learning C++ and notes that the tutorial will demonstrate features of the language through examples while emphasizing learning through practice.
FITC events. For digital creators.
Save 10% off ANY FITC event with discount code 'slideshare'
See our upcoming events at www.fitc.ca
An Intro To ES6
with Grant Skinner
OVERVIEW
ECMAScript 6 is the approved and published standard for the next version of JavaScript. It offers new syntax and language features that provide new ways of tackling coding problems, and increase your productivity.
This session will introduce ES6 and delve into many of the new features of the language. It will also cover real-world use, including transpilers, runtimes, and browser support.
OBJECTIVE
Create confidence in evaluating and getting started using ES6.
TARGET AUDIENCE
JavaScript developers.
ASSUMED AUDIENCE KNOWLEDGE
JavaScript.
FOUR THINGS AUDIENCE MEMBERS WILL LEARN
Status of ES6
How to get started with ES6
ES6 feature overview
Practical considerations for adopting ES6
FITC events. For digital creators.
Save 10% off ANY FITC event with discount code 'slideshare'
See our upcoming events at www.fitc.ca
An Intro To ES6
with Grant Skinner
OVERVIEW
ECMAScript 6 is the approved and published standard for the next version of JavaScript. It offers new syntax and language features that provide new ways of tackling coding problems, and increase your productivity.
This session will introduce ES6 and delve into many of the new features of the language. It will also cover real-world use, including transpilers, runtimes, and browser support.
OBJECTIVE
Create confidence in evaluating and getting started using ES6.
TARGET AUDIENCE
JavaScript developers.
ASSUMED AUDIENCE KNOWLEDGE
JavaScript.
FOUR THINGS AUDIENCE MEMBERS WILL LEARN
Status of ES6
How to get started with ES6
ES6 feature overview
Practical considerations for adopting ES6
Explaining ES6: JavaScript History and What is to ComeCory Forsyth
An overview of some of the history of JavaScript, how it became ECMAScript (and what Ecma is), as well as highlights of the new features and syntax in ES6 aka ES2015.
Originally presented to the New York Public Library on June 4 2015.
Presentation I gave at a Rust Austin meetup in November 2018 about exploring different approaches for interpreting custom DSLs in Rust with varying speed characteristics and associated safety issues.
This presentation was held at the Stockholm Rust Meetup in September 2019.
This is a brief introduction to Rust and highlights some of the problems with C++ that it attempts to solve. It also contain a brief introduction to the ownership model and the borrow checker that Rust uses.
The python interpreter converts programs to bytecodes before beginning execution. Execution itself consist of looping over these bytecodes and performing specific operations over each one. This talk gives a very brief overview of the main classes of bytecodes.
This presentation was given as a lightning talk at the Boston Python Meetup group on July 24th, 2012.
This contains all the slides used in Silicon Valley Code Camp presentation on Sunday Oct 4, 10:45 session on "Amazing new features in JavaScript". At the end ut also includes the last year presentation covering ES 5
C++ is a middle-level programming language developed by Bjarne Stroustrup starting in 1979 at Bell Labs. C++ runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.
This reference will take you through simple and practical approach while learning C++ Programming language.
Explaining ES6: JavaScript History and What is to ComeCory Forsyth
An overview of some of the history of JavaScript, how it became ECMAScript (and what Ecma is), as well as highlights of the new features and syntax in ES6 aka ES2015.
Originally presented to the New York Public Library on June 4 2015.
Presentation I gave at a Rust Austin meetup in November 2018 about exploring different approaches for interpreting custom DSLs in Rust with varying speed characteristics and associated safety issues.
This presentation was held at the Stockholm Rust Meetup in September 2019.
This is a brief introduction to Rust and highlights some of the problems with C++ that it attempts to solve. It also contain a brief introduction to the ownership model and the borrow checker that Rust uses.
The python interpreter converts programs to bytecodes before beginning execution. Execution itself consist of looping over these bytecodes and performing specific operations over each one. This talk gives a very brief overview of the main classes of bytecodes.
This presentation was given as a lightning talk at the Boston Python Meetup group on July 24th, 2012.
This contains all the slides used in Silicon Valley Code Camp presentation on Sunday Oct 4, 10:45 session on "Amazing new features in JavaScript". At the end ut also includes the last year presentation covering ES 5
C++ is a middle-level programming language developed by Bjarne Stroustrup starting in 1979 at Bell Labs. C++ runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.
This reference will take you through simple and practical approach while learning C++ Programming language.
Oh Crap, I Forgot (Or Never Learned) C! [CodeMash 2010]Chris Adamson
Abstract: Chances are you code in a language that's either descended from C, inspired by C, or run in an interpreter that itself is written in C. Still... do you actually know how to code in C? Despite its long-standing position as a sort of "lingua franca", an agreed-upon common language, more and more developers are putting together successful, satisfying careers, without ever learning this seminal language. But what if you have to call into C code from your favorite scripting language, or use APIs like OpenGL that are written to be called from C? Many developers find C very challenging, particularly its manual memory-management and other low-level concerns. In this session, we'll show you why you shouldn't be afraid of C, how you can use the skills you already have from the languages you code in today, and how to master structs, enums, typedefs, malloc(), free(), and the rest of C's sharp edges. Examples will be from the point-of-view of the C-skewing iPhone SDK, but will be designed to be broadly applicable and platform-agnostic.
Despite being a slow interpreter, Python is a key component in high-performance computing (HPC). Python is easy to use. C++ is fast. Together they are a beautiful blend. A new tool, pybind11, makes this approach even more attractive to HPC code. It focuses on the niceties C++11 brings in. Beyond the syntactic sugar around the Python C API, it is interesting to see how pybind11 handles the vast difference between the two languages, and what matters to HPC.
Python is a high level language focused on readability. The Python community developed the concept of "Pythonic Code", requiring not only semantic correctness, but also conformity to universally acknowledged stylistic criteria.
A pre-requisite to write pythonic code is to write idiomatic code. Using the right idioms is a matter of acquired taste and experience, however, some idioms are quite easy to learn.
This presentation focuses on some of these idioms and other stylistic criteria:
* for vs. while
* iterators, itertools
* code conventions (space invaders)
* avoid default values bugs
* first order functions
* internal/external iterators
* substituting the switch statement
* properties, attributes, read only objects
* named tuples
* duck typings
* bits of metaprogramming
* exception management: LBYL vs. EAFP
My talk at BarCamp London 5: An introduction to Cocoa development and how web developers can cheat.
Source code to go with this presentation is available here: http://georgebrock.com/conferences/barcamplondon5
MATHEMATICS BRIDGE COURSE (TEN DAYS PLANNER) (FOR CLASS XI STUDENTS GOING TO ...PinkySharma900491
Class khatm kaam kaam karne kk kabhi uske kk innings evening karni nnod ennu Tak add djdhejs a Nissan s isme sniff kaam GCC bagg GB g ghan HD smart karmathtaa Niven ken many bhej kaam karne Nissan kaam kaam Karo kaam lal mam cell pal xoxo
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR - Slides Onl...Peter Gallagher
In this session delivered at Leeds IoT, I talk about how you can control a 3D printed Robot Arm with a Raspberry Pi, .NET 8, Blazor and SignalR.
I also show how you can use a Unity app on an Meta Quest 3 to control the arm VR too.
You can find the GitHub repo and workshop instructions here;
https://bit.ly/dotnetrobotgithub
2. This tutorial offers several things.
You’ll see some neat features of the language.
You’ll learn the right things to google.
You’ll find a list of useful books and web pages.
But don’t expect too much!
It’s complicated, and you’ll learn by doing.
But I’ll give it my best shot, okay?
3. Basic syntax
Compiling your program
Argument passing
Dynamic memory
Object-oriented programming
4. #include <iostream> Includes function definitions
using namespace std; for
console input and output.
float c(float x) {
return x*x*x; Function declaration.
} Function definition.
int main() {
float x; Program starts here.
cin >> x; Local variable declaration.
cout << c(x) << endl;
Console input.
return 0; Console output.
} Exit main function.
5.
6. // This is main.cc // This is mymath.h
#include <iostream> #ifndef MYMATH
#include “mymath.h” #define MYMATH
using namespace std;
float c(float x);
int main() { float d(float x);
// ...stuff...
} #endif
Functions are declared in m at h. h, but not defined.
ym
They are implemented separately in m at h. c c .
ym
8. // This is main.cc
#include <GL/glut.h> Include OpenGL functions.
#include <iostream> Include standard IO
using namespace std; functions.
Long and tedious
int main() { explanation.
cout << “Hello!” << endl;
glVertex3d(1,2,3);
return 0; Calls function from standard
} IO.
Calls function from OpenGL.
% g++ -c main.cc Make object file.
Make executable, link GLUT.
% g++ -o myprogram –lglut main.o Execute program.
% ./myprogram
9. Software engineering reasons.
Separate interface from implementation.
Promote modularity.
The headers are a contract.
Technical reasons.
Only rebuild object files for modified source files.
This is much more efficient for huge programs.
10. Most assignments include
INCFLAGS =
-
I/afs/csail/group/graphics/courses/6.837/public/includ
makef i l es , which describe
e
LINKFLAGS =
-L/afs/csail/group/graphics/courses/6.837/public/lib
CFLAGS
-lglut -lvl
= -g -Wall -ansi
the files, dependencies, and
CC
SRCS
= g++
= main.cc parse.cc curve.cc surf.cc camera.cc steps for compilation.
OBJS = $(SRCS:.cc=.o)
PROG = a1
You can just type m
all: $(SRCS) $(PROG)
$(PROG): $(OBJS)
ake.
$(CC) $(CFLAGS) $(OBJS) -o $@ $(LINKFLAGS)
.cc.o:
So you don’t have to know
$(CC) $(CFLAGS) $< -c -o $@ $(INCFLAGS)
the stuff from the past few
depend:
makedepend $(INCFLAGS) -Y $(SRCS)
clean:
rm $(OBJS) $(PROG) slides.
main.o: parse.h curve.h tuple.h
But it’s nice to know.
# ... LOTS MORE ...
11.
12. #include <iostream>
using namespace std;
int main() { Arrays must have known
int n;
sizes at compile time.
cin >> n;
float f[n];
This doesn’t compile.
for (int i=0; i<n; i++)
f[i] = i;
return 0;
}
13. #include <iostream>
Allocate the array during
using namespace std;
runtime using new.
int main() {
int n;
cin >> n; No garbage collection, so
float *f = new float[n]; you have to delete.
for (int i=0; i<n; i++)
f[i] = i; Dynamic memory is
useful when you don’t
delete [] f;
return 0; know how much space
} you need.
14. #include <iostream>
STL vector is a resizable
#include <vector>
using namespace std; array with all dynamic
memory handled for you.
int main() {
int n;
cin >> n; STL has other cool stuff,
vector<float> f(n); such as strings and sets.
for (int i=0; i<n; i++)
f[i] = i;
If you can, use the STL
return 0; and avoid dynamic
} memory.
15. #include <iostream>
#include <vector>
using namespace std; An alternative method
that does the same thing.
int main() {
int n;
cin >> n; Methods are called with
vector<float> f;
the dot operator (same as
for (int i=0; i<n; i++) Java).
f.push_back(i);
return 0; vector is poorly named,
} it’s actually just an array.
16. float twice1(float x) { This works as expected.
return 2*x;
}
void twice2(float x) {
x = 2*x;
This does nothing.
}
int main() {
float x = 3;
twice2(x);
cout << x << endl; The variable is
return 0; unchanged.
}
17. vector<float>
twice(vector<float> x) {
int n = x.size(); There is an incredible
for (int i=0; i<n; i++) amount of overhead here.
x[i] = 2*x[i];
return x;
}
This copies a huge array
int main() { two times. It’s stupid.
vector<float>
y(9000000);
y = twice(y); Maybe the compiler’s
return 0; smart. Maybe not. Why
}
risk it?
18. void twice3(float *x) { Pass pointer by value
(*x) = 2*(*x);
and
}
access data using
void twice4(float &x) { asterisk.
x = 2*x;
}
Pass by reference.
int main() {
float x = 3;
twice3(&x);
twice4(x);
return 0;
} Address of variable.
The answer is 12.
19. You’ll often see objects passed by reference.
Functions can modify objects without copying.
To avoid copying objects (often const references).
Pointers are kind of old school, but still useful.
For super-efficient low-level code.
Within objects to handle dynamic memory.
You shouldn’t need pointers for this class.
Use the STL instead, if at all possible.
20.
21. Classes implement objects.
You’ve probably seen these in 6.170.
C++ does things a little differently.
Let’s implement a simple image object.
Show stuff we’ve seen, like dynamic memory.
Introduce constructors, destructors, const, and
operator overloading.
I’ll probably make mistakes, so some debugging too.
23. The C++ Programming Language
A book by Bjarne Stroustrup, inventor of C++.
My favorite C++ book.
The STL Programmer’s Guide
Contains documentation for the standard template library.
http://www.sgi.com/tech/stl/
Java to C++ Transition Tutorial
Probably the most helpful, since you’ve all taken 6.170.
http://www.cs.brown.edu/courses/cs123/javatoc.shtml
Editor's Notes
about as simple as it gets – just get a feel for the syntax but you’ll have more complicated programs so you want to organize better first way to do that is by separating into multiple files
same program, but we’ve pulled c functions out we put it in a separate file … or rather, two separate files header file (you see on the right) declares the functions – that is, gives name, parameters, return type. but doesn’t include the implementation, which is done in a separate file. so when you code up the main program file, you can include the header file, and call the functions because in c++ you can only call functions that are declared.
so here’s the basic setup you write a bunch of cc files that implement functions (or objects, as we’ll see later) the headers include the declarations of functions (or objects) include the headers in the cc files if you’re using those functions compile to object files link all object files together get program make graphics
almost all c++ will make use of libraries bunch of convenient functions that you can use two libraries you’ll be using for almost assignments are glut (exp) and iostream (exp) so main here actually calls functions defined in both these libraries and here’s how we might compile
why? examples of purely functional programming languages… haskell, basic scheme…
why? examples of purely functional programming languages… haskell, basic scheme…
why? examples of purely functional programming languages… haskell, basic scheme…
why? examples of purely functional programming languages… haskell, basic scheme…