Top Banner
General Computer Science General Computer Science for Engineers for Engineers CISC 106 CISC 106 Lecture 26 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009
14

General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

General Computer General Computer Science Science

for Engineersfor EngineersCISC 106CISC 106

Lecture 26Lecture 26

Dr. John CavazosComputer and Information Sciences

04/24/2009

Page 2: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

Lecture OverviewLecture OverviewIntroducing C++C++ vs. MATLABMore about C++

Page 3: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

A programming languageDerived from a language called CUbiquitous Object Oriented

◦Easier to write large scale projects◦Reusability

High Performance

Page 4: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

Supports data securityHelps code reuseAllows multiple functions/operators with same name

Page 5: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

Large projectsSystems applicationsGraphicsData StructuresWant to speed up your scripts 

Page 6: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

When not to use C++When not to use C++Small programsPrototyping (MATLAB, scripting

languages)Web applications (javascript)

Page 7: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

C++ versus MATLABC++ versus MATLABMATLAB uses an interpreter

To run can just type and use matlab commands

C++ uses a compilerProgram converted to machine code

with compiler

Page 8: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

C++ versus MATLABC++ versus MATLABMATLAB uses dynamic typing

Introduce new variables as neededType of variable discovered by use

C++ uses static typingVariables have to be introducedType is given when introduced

Page 9: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

C++ Data TypesC++ Data Types

Page 10: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

Must introduce variables before using“Double quotes” for stringsInput and output

int studentAge;

cout << “How old are you?”;cin >> studentAge;

 

Page 11: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

Arrows “show the way” data if flowing

cout << … going out (output)cin >> … going in (input)

Page 12: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

cout << “Student Age” << 20 << endl;

int i;float f;cin >> i;cin >> f;

Page 13: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

#include <iostream>using namespace std;

int main(){ // display output cout << “Hello World\n”;}

 

Page 14: General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.

$ CC –o helloworld helloworld.cc$ ./helloworldHello World$