Computer System. Computer hardware. Application software: Time-Sharing Environment. Introduction to Computer and C++ Programming.

Similar documents
Computer Science Undergraduate Scholarship

Research Administration & Proposal Submission System (RAPSS) Central Office Quick Reference

Chapter 4. Disbursements

Psychiatric Consultant Guide SPIRIT CMTS. Care Management Tracking System. University of Washington aims.uw.edu

Psychiatric Consultant Guide CMTS. Care Management Tracking System. University of Washington aims.uw.edu

Kansas University Medical Center ecrt Department Administrator Training. June 2008

Table of Contents Click on the title to navigate to that section of the document.

Soarian Clinicals View Only

Coeus Premium Institute Proposal Guide Overview & Field Definitions

PMP & ChiroWrite Integration

Resumé Wizard Student User Guide Step by step guide on how to use Resumé Wizard found inside My Compass to My Career

Effort Coordinator Training. University of Kansas Summer 2016

ipm Information Sheet

CareFacts Frequently Asked Question FAQ O: How To Keep Your Care Plan Up To Date

Point of Care: Medication Pass with Pre-Pour

MONITORING PATIENTS. Responding to Readings

ECE Computer Engineering I. ECE Introduction. Z. Aliyazicioglu. Electrical and Computer Engineering Department Cal Poly Pomona

EFIS. (Education Finance Information System) Training Guide and User s Guide

4 ENTERING PATIENT INFORMATION

CLARK ATLANTA UNIVERSITY TITLE III PROGRAM ADMINISTRATION CAT-TRAC OPERATIONS MANUAL

PATIENT PORTAL USERS GUIDE

GLI Standards Composite Submission Requirements Initial Release, Version: 1.0 Release Date: August 25, 2011

DWA Standard APEX Key Glencoe

PATIENT ACCESS LIST (PAL)

CSE255 Introduction to Databases - Fall 2007 Semester Project Overview and Phase I

EMAR Medication Pass

SCHEME JABATAN PELAJARAN NEGERI SEMBILAN

HELLO HEALTH TRAINING MANUAL

ecrt System 4.5 Training

FoodTech Calibration Software for Windows 98 and up

U.S. Army Audit Agency

GUIDANCE HOW TO IMPLEMENT THE PROJECT VIA THE ELECTRONIC MONITORING SYSTEM (PART II)

Post-Production, Visual Effects and Digital Animation Grant GUIDE TO APPLICATION SUBMISSION

Common Core Algebra 2 Course Guide

proposalcentral Version 2.0 Creating a proposalcentral Application.

Using PowerChart: Organizer View

Peoplesoft Effort Certification. Participant s Manual

CLINICAL CHARTING USER INTERFACE

Basic Articulate Training Manual. Conducted by: Sole Articulate Official Representative in Singapore, Malaysia and 29 other countries in this region

Emergency Care, Rx Writer, Exit Care

Grants.gov Adobe Manual for Windows Users

ADULT LEARNING ACADEMY

Volunteer Management Information System Army Volunteer Corps Volunteer User Guide

Quick Reference. Virtual OneStop (VOS) Individual User Logging In. My Workspace* (My Dashboard ) Settings and Themes. Quick Menu*

Development Coeus Premium. Proposal Development

CPOM TRAINING. Page 1

Impact Grant Application COVER SHEET

Coeus Release Department Users Enhancements and Changes

MASSAid School User Guide. Table of Contents

Millennium PowerChart Orders Reference Guide Created by Organizational Learning & Development, Clinical IT/Nursing Informatics: June 4, 2013

CIS192 Python Programming. Dan Gillis. January 20th, 2016

Creating your job seeker account

EMAR Medication Pass with Pre-Pour

Care Manager Guide SPIRIT CMTS. Care Management Tracking System. University of Washington aims.uw.edu

USDA. Self-Help Automated Reporting and Evaluation System SHARES 1.0. User Guide

training Computerized Physician Order Management (CPOM): Medical Staff Training

Hi Tech Software Solutions Are You Still Handwriting Care Plans?

State of Florida. Department of Economic Opportunity. One Stop Management Information System (OSMIS) Regional Financial Management User Manual

Find & Apply. User Guide

Department of Defense DIRECTIVE

Care Planning User Guide June 2011

QOF queries in SystmOne

ECE Computer Engineering I. Z. Aliyazicioglu. Electrical and Computer Engineering Department Cal Poly Pomona

GLOBALMEET FOR OUTLOOK RELEASE 12.3

Reimbursements: Submit a Flat Rate Reimbursement

Grant Reporting for Faculty Grant Expense Detail

CareTracker Patient Portal Tips

User Guide on Jobs Bank (Individuals)

PharmaClik Rx 1.4. Quick Guide

Required Charting for Discharges

Online Students Registration System (OSRS)

User Guide on Jobs Bank Portal (Employers)

14: Manage Labor Exchange

C. The Assessment Wizard

EMAR Pending Review. The purpose of Pending Review is to verify the orders received from the pharmacy.

NURSINGCAS CONFIGURATION MANAGER HELP GUIDE

Sevocity v.12 Patient Reminders User Reference Guide

Fault Tree Analysis (FTA) Kim R. Fowler KSU ECE February 2013

SYSTEM REQUIREMENTS AND USEFUL INFORMATION LOGGING INTO THE PERIS PORTAL

DOD SPECIFICATIONS FOR INTERACTIVE ELECTRONIC TECHNICAL MANUALS (IETM)

Chapter Contents. Manage Résumé Screen

Overview What is effort? What is effort reporting? Why is Effort Reporting necessary?... 2

Electronic Medication Reconciliation and Depart Process Overview Nursing Deck

Site Manager Guide CMTS. Care Management Tracking System. University of Washington aims.uw.edu

BAWSCA Water Conservation Database RFP Addendum #1 Consultant Questions and Answers

Copyright 2013 GE Multilin Inc. All rights reserved. Power Management Control System (PMCS) software revision EnerVista, Integrator, Digital

Site Install Guide. Hardware Installation and Configuration

Health Care Home Risk Stratification Tool User Guide

Copyright. Last updated: September 28, 2017 MicroMD EMR Objective Measure Calculations Manual: Performance Year 2017

Welcome to ECW Version 10

Siebel Smart Answer Guide. Siebel Innovation Pack 2013 Version 8.1/8.2 September 2013

19: Manage Labor Exchange

Completing a Medication History Inpatient Nurses

University of Miami Clinical Enterprise Technologies

Planning Calendar Grade 5 Advanced Mathematics. Monday Tuesday Wednesday Thursday Friday 08/20 T1 Begins

GLOBALMEET GLOBALMEET USER GUIDE

Proposal Writing. ECE 2031 Design Proposal Assignment. Kevin Johnson

Reporting in the ems Manual

User Guide on Jobs Bank Portal (Employers)

PENNSYLVANIA MEDICAL ASSISTANCE EHR INCENTIVE PROGRAM ELIGIBLE HOSPITAL PROVIDER MANUAL

Transcription:

ECE 114 1 Computer System Introduction to Computer and C++ Programming Computer System Dr. Z. Aliyazicioglu Cal Poly Pomona Electrical & Computer Engineering Cal Poly Pomona Electrical & Computer Engineering 1 Hardware Software Cal Poly Pomona ECE 114-1 2 Computer hardware CPU - Primary Storage Computer Software Software System Software Application Software Input Devices Auxiliary Storage Devices Devices System Software : manage the hardware resources of a computer and perform required information processing tasks. Operating system provides services such as a user interface, file and database access, and interfaces to communication System support software provides system utilities. System development software converts your program into machine language for execution Cal Poly Pomona ECE 114-1 3 Cal Poly Pomona ECE 114-1 4 Application software: General purpose software is purchased from a software developer and can be used more than one application Application specific software can be used only for its intended purpose. Time-Sharing Environment Many user are connected to one or more computers. These computers may be minicomputer or central mainframe. All of the computing must be done by the central computer Cal Poly Pomona ECE 114-1 5 Cal Poly Pomona ECE 114-1 6

Client/Server Environment Split the computing function between a central computer and users computers. Users computers are called the client History of Computer Languages We must use a computer language to write a program for a computer. Hundreds of Computer Languages are in use today 1940s Machine Languages 1950s Assemble Languages 1960s High Level Languages 1970s 1980s 1990s Natural Languages Cal Poly Pomona ECE 114-1 7 Cal Poly Pomona ECE 114-1 8 High-Level Languages FORTRAN FORmula TRANslations BASIC Beginners All-purpose Symbolic Instructional Code PASCAL COBOL COmmon Business Oriented Language C Combines the power of an assembly language with the ease of use and portability of a high-level language ADA Designed for real-time distributed systems. LISP Used in artificial intelligence applications History of C and C++ BCPL language was developed in 1967 by Martin Richards for writing operating system and compiler. Ken Thomas modeled many features in his language B after BCPL and used it to create early version of UNIX Operating system at Bell Lab. C language was evolved from B by Dennis Ritchie at Bell Lab in 1972. C used many important concepts of B and BCPL and adding other features. C++ language was evolved from C by Bjarne Straustrup in early 1980s at Bell Lab. It has new features and important one is that it is object-oriented programming. Visual C++ is developed in 1990s. Developers use graphical tools to create applications. Cal Poly Pomona ECE 114-1 9 Cal Poly Pomona ECE 114-1 10 Introduction to Microsoft.NET Structured Programming Microsoft introduced.net in June 2000 Strategy is its independence from a specific language or platform It is new software development model that allows applications created in disparate programming languages to communicate each other Creates Web-based applications In 1960s, people realize that software development was complex activity. Writing structured program is clear to understand, easy to test and debug, and easy to modify. Pascal programming language was developed in 1971 and Blaise Pascal was designed for teaching structured programming in academic area. ADA programming language was developed during 1970s under DOD. One important capability of ADA is multitasking. This allows to programmer to specify many activities are to occur parallel Cal Poly Pomona ECE 114-1 11 Cal Poly Pomona ECE 114-1 12

Object Technology The goal is building software quickly, correctly, and economically. Software developers discovered that using a modular, object-oriented design and implementation approach can make software much more productive. Object-oriented programs are often easier to understand, correct and modify. Object-oriented programming became widely used in the 1980s. C++ Standard Library C++ has rich collections of existing classes and functions in the C++ standard library. First is learning the C++ language itself Second is learning how to use the classes and functions Cal Poly Pomona ECE 114-1 13 Cal Poly Pomona ECE 114-1 14 Art + Science Problem Solving - Ask the right questions in order to clarify the problem. - Analyze the problem to extract its essential features. - Determine whether any constrains or simplifying assumptions can be applied to facilitate the problem solution. Good Problem Solver - Knowledge of the problem environment - Knowledge of the formulas or equations that characterize the environment Good Programmer Software Development Method 1- Requirements Specifications State the problem and gain a clear understanding of what is required for its solution 2- Analysis Identify the problem s : - Inputs -s - Constraints on the solutions. 3- Design Develop a list of steps called an algorithm to solve the problem. Verify that it is correct. Cal Poly Pomona ECE 114-1 15 Cal Poly Pomona ECE 114-1 16 Software Development Method (cont) 4- Implementations Implement the algorithm as a program 5- Verification and Testing Test the program and verify that it meets the original requirements specified for the program. Don t rely on just one test case. Run the program using several different sets of data. Debugging Making mistakes is a natural part of learning. Debugging is the finding and fixing of program mistakes (errors) Porting Adapt the program so that it runs on a different computer system Cal Poly Pomona ECE 114-1 17 Cal Poly Pomona ECE 114-1 18

Stepwise Refinement The refinement of an outline into more detailed steps can be done with: - Psedocode uses English-like Statements to describe the steps in an algorithm -Flowchart uses a diagram to describe the steps in algorithm Case Study Finding the Area and circumference of a circle 1- Take the radius of a circle and compute and print its area and circumference 2- Inputs: Circle radius s: Area of the circle Circumference of the circle Constants: PI = 3.14159 Formula: area = π r 2 circumference = 2 π r 3- Get circle radius Calculate area Calculate circumference Display area and circumference Cal Poly Pomona ECE 114-1 19 Cal Poly Pomona ECE 114-1 20 Psedocode & Flowchart Operation Pseudocode Flowchart Input Compute read radius set area to π*radius 2 and circum to 2*pi*radius print radius, area and circum read radius area = π. radius 2 circum = 2 * PI * radius print radius, area Cal Poly Pomona ECE 114-1 21 Source Code // Calculate and displays the area and circumference of a circle # include < stdio.h > /* directive */ # define PI 3.14159 int main (void) double radius, area, circum ; /* Get the circle radius */ printf (" Enter radius > ") ; scanf ( "%lf ", &radius); /* Calculate the area */ area = PI * radius * radius ; /* Calculate the circumference */ circum = 2 * PI * radius ; /* Display the area and circumference */ printf ( " The area is %f \n ", area) ; printf ( "The circumference is %f \n ", circum) ; return (0) ; Cal Poly Pomona ECE 114-1 22 Using.NET Environment Start up Microsoft Visual studio.net. The following window should be displayed New Project dialog box will be displayed Select Visual C++ Project in the Project Types pane, Select Win32 Console Project in the temples pane. Type project Name in Name box Choose location for your project. Then, Click OK Click New Project or Under the File menu, point to New, and then click Project Cal Poly Pomona ECE 114-1 23 Cal Poly Pomona ECE 114-1 24

Click the Application Settings text on the left side The right side dialog box is changed to show the current wizard settings Select Console Application and Empty Project, click finish Cal Poly Pomona ECE 114-1 25 Cal Poly Pomona ECE 114-1 26 Adding a C++ Source File to the project Either right-click the prog1 icon in Solution Explorer, point to Add, and then click Add New Item, or Click the Add New Item Button on the toolbars Select C++ File (.cpp) from the Templetes pane on the right Type prog1.cpp in the Name box, and click Open Cal Poly Pomona ECE 114-1 27 Cal Poly Pomona ECE 114-1 28 Type the source code for the program, as shown here To build the executable, select Build Solution from the Build menu Cal Poly Pomona ECE 114-1 29 If no error, the message is Build: 1 succeeded, 0 failed, 0 skiped Cal Poly Pomona ECE 114-1 30

Once you have successfully built the project, Choose Start Without Debugging from the Debug menu to run the program My first program // Program:pr1.cpp // A first program in C++ cout << "Welcome to C++!\n"; // indicates that the remainder of each line is a command Processor directives tells the processor include in the program the contents of the input/output stream header file Main is a program building block called a function Print on the screen the string of characters Cal Poly Pomona ECE 114-1 31 Cal Poly Pomona ECE 114-1 32 Some Common Escape Sequence \n New line. Goes to beginning of the next line \t Horizontal tab Move the screen cursor to the next tab stop \r Carriage return. Position the screen cursor to the beginning of the current line. \a Alert. Sound the system \\ Backslash. Print a backslash character \ Double quote. Print double quote character Example // pr2.cpp // Printing a line with multiple statements cout << "Welcome "; cout << "to C++!\n"; Cal Poly Pomona ECE 114-1 33 Cal Poly Pomona ECE 114-1 34 Example // pr5.cpp // Printing multiple lines with a single statement cout << "Welcome\nto\n\nC++!\n"; Using new-style header files // Using new-style header files using namespace std; cout << "Welcome to C++!\n"; cout << "Welcome to C++!\n"; Cal Poly Pomona ECE 114-1 35 Cal Poly Pomona ECE 114-1 36

Example: // Program: pr6.cpp // Printing multiple lines to draw a head using std::endl; cout << " "<<endl; cout << " "<<endl; cout << " o o "<<endl; cout << " _ _ "<<endl; cout << " "<<endl; cout << " "<<endl; cout << " "<<endl; cout << " \\ / "<<endl; Cal Poly Pomona ECE 114-1 37 // Fig. prog4.cpp 1.5: fig01_05.cpp // Printing multiple lines with to draw a single glasses statement face using std::endl; cout << " "<<endl; cout << " "<<endl; cout << " "<<endl; cout << " - o -- o - "<<endl; cout << " _ - - _ "<<endl; cout << " "<<endl; cout << " "<<endl; cout << " "<<endl; cout << " \\ / "<<endl; return 0; // indicate that program ended successfully Cal Poly Pomona ECE 114-1 38 An Addition Program // prog5.cpp // Addition program using std::cin; using std::endl; int integer1, integer2, sum; // declaration C+++ Operation Arithmetic Operation Arithmetic Operation Algebraic Operations C++ Expression Addition + f + 7 f + 7 Subtraction - p - c p - c cout << "Enter first integer\n"; // prompt cin >> integer1; // read an integer Multiplication * bm b * m cout << "Enter second integer\n"; // prompt cin >> integer2; // read an integer sum = integer1 + integer2; // assignment of sum Division / x / y x / y cout << "Sum is " << sum << endl; // print sum Modulus % r mod s r % s Cal Poly Pomona ECE 114-1 39 Cal Poly Pomona ECE 114-1 40 Precedence of Arithmetic Operators Equality and relational Operators Operators Operations Order of Evaluation Standard algebraic equality operator or relational operators C++ equality or relational operator Example of C++ condition Meaning of C++ condition ( ) Parentheses *,/,or % + or - Multiplication Division Modulus Addition Subtraction Evaluate first. If there are several, evaluate left to right Evaluate second. If there are several evaluate left to right Evaluate last. If there are several, evaluate left to right equality operator = relational operators > < = =!= > < >= <= x = = y x!= y x > y x < y x >= y x <= y x is equal to y x is not equal to y x is greater than y x is less than y x is greater than or equal to y x is less than or equal to y Cal Poly Pomona ECE 114-1 41 Cal Poly Pomona ECE 114-1 42

Using equality and relational operations // Using if statements, relational // operators, and equality operators using std::cin; using std::endl; int num1, num2; cout << "Enter two integers, and I will tell you\n" << "the relationships they satisfy: "; cin >> num1 >> num2; // read two integers (cont) if ( num1 == num2 ) cout << num1 << " is equal to " << num2 << endl; if ( num1!= num2 ) cout << num1 << " is not equal to " << num2 << endl; if ( num1 < num2 ) cout << num1 << " is less than " << num2 << endl; Cal Poly Pomona ECE 114-1 43 Cal Poly Pomona ECE 114-1 44 (cont) if ( num1 > num2 ) cout << num1 << " is greater than " << num2 << endl; Homework-1 Question.1 Write a program that print your initial in large format such as in 8 lines if ( num1 <= num2 ) cout << num1 << " is less than or equal to " << num2 << endl; if ( num1 >= num2 ) cout << num1 << " is greater than or equal to " << num2 << endl; Cal Poly Pomona ECE 114-1 45 Cal Poly Pomona ECE 114-1 46 Homework-1 Question.2 Write a program that inputs three integer from the keyboard and print the sum, average, product, smallest, and largest of these numbers. The screen dialogue should appear as fallow Problem Given the algebraic equation y=ax 3 + y. Write the correct C++ statements for this equation. Input three different integers:13 27 14 Sum is 54 Average is 18 Product is 4914 Smallest is 13 Largest is 27 y=a*pow(x,3)+y; y=a*(x*x*x)+y; Cal Poly Pomona ECE 114-1 47 Cal Poly Pomona ECE 114-1 48

Homework-1 Question.3 Using only the techniques you learned in this chapter, write a program that calculates the squares and cubes of the number from 0 to 10 and uses tabs to print the following table of values. Number Square Cube 0 0 0 1 1 1 2 4 8 3 9 27 4 16 64 5 25 125 Cal Poly Pomona ECE 114-1 49