lecture1

lecture1 - Wednesday, Oct 6 th Youre gonna learn how to...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Wednesday, Oct 6 th Youre gonna learn how to program today! (If youve programmed before, then ponder on this brain teaser to relieve your boredom). main() { int a = 5, b = 10; a = <fill this in>; b = <fill this in>; a = <fill this in>; } Using only addition and subtraction, fill in the blanks to swap the values of a and b Agenda Learn about the programming process Questions about Project #1? Our first C++ programs: Learn how to print to the screen Learn about variables Learn about mathematical operators in C++ Learn how to input more than one number at a time Lets Play. Programming Language Inventor Or Serial Killer See if you can guess who uses a keyboard and who uses a chainsaw! The Programming Process Design your program Edit your program Compile your program Run and test your program Does it compile without errors? Yes No Does it work correctly? No Yes Actual Programming Process Deep-6 It Design Goal: Figure out how your program is going to work before you write a single line of logic. Things to think about: What is the problem youre trying to solve? What are your requirements ? What are the main tasks required to solve the problem? How should you organize your program to best address the problem? Editing Your Program Goal: Type in your program source code in a text editor , word processor or in Visual Studio . #include <iostream> void main(void) { std::cout << GO BRUINS!"; } Things to think about: Using proper programming style Make your program easy to read! Using proper syntax and semantics Syntax vs. Semantics Syntax : When you write a program, you have to follow the programming languages grammar or syntax rules . If your program has syntax errors , the compiler is unable to translate it into machine language. Semantics : A programs logic and behavior when running are called its semantics . A program with bad semantics (bad logic) will compile and run, but has the wrong behavior. Syntax Errors vs. Semantic Errors Question: which is which? UCLA students, is smartest, compared of USC students? USC students are smarter than UCLA students. Compiling your Program Goal: Translate your program from C++ source code into a working program ( into machine code )! #include <iostream> void main(void) { std::cout << GO BRUINS!"; } 57119 10 4699 3 MyProg.exe Compiling your Program Goal: Translate your program from C++ source code into a working program! MyProg GO BRUINS! (Whats happening under the hood is a bit more complicated than this, but thats the general idea) Running and Testing Your Program Goal: Make sure you dont have any semantic errors in your program logic....
View Full Document

Page1 / 44

lecture1 - Wednesday, Oct 6 th Youre gonna learn how to...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online